摘要:
--方法1: EXEC xp_dirtree '\\172.6.6.6\D$\TEXT\',1,1 --方法2: CREATE TABLE #TXT_Name (NAME VARCHAR( 2000)) SET @iSQL='DIR \\172.6.6.6\D$\TEXT\ /ON/B >D:\TEST.TXT' EXEC master..xp_cmdshell @iSQL,no_outpu... 阅读全文
摘要:
SET @iSQL=N'BULK INSERT [TEST].[dbo].[TEST_Interim]'+' FROM '+quotename(@fullFileName,'''')+' WITH (BATCHSIZE=1000,FIELDTERMINATOR=''\t'',DATAFILETYPE=''widechar'',FIRSTROW=1,ROWTERMINATOR=''\n'',TAB... 阅读全文
摘要:
SET @FilePath='D:\TEST.xls' SET @sql='bcp "SELECT * FROM XXX.dbo.XXX WITH(NOLOCK) WHERE XXX=''XXX'' AND XXX = '+@XXX+'" QueryOut '+@FilePath+' -c -T ' EXEC master..xp_cmdshell @SQL 阅读全文
摘要:
--exec master..xp_cmdshell CMD命令 --EXECUTE sys.sp_sqlexec 执行存储 --EXEC sp_executesql 执行DML语句 阅读全文
摘要:
--根据关键字查询SP select distinct a.name from sysobjects a,syscomments b where a.id=b.id and a.xtype='P' and b.text like '%XXXXX%' order by name --根据列名查询table SELECT a.name AS TableName,b.Name,b.[length] F... 阅读全文
摘要:
CREATE FUNCTION [dbo].[FormatDate] (@date as datetime, @formatstring as varchar(100) ) RETURNS varchar(100) AS BEGIN declare @datestring as varchar(100) set @datestring=@formatstring --year set @d... 阅读全文
摘要:
CREATE FUNCTION [dbo].[Func_Split] ( @inputstr VARCHAR(max), @seprator VARCHAR(10) ) RETURNS @temp TABLE (A VARCHAR(200)) AS BEGIN DECLARE @i INT SET @inputstr = RTRIM(LTRIM(@inputstr)) SET ... 阅读全文
摘要:
DECLARE cur1 CURSOR SCROLL FOR SELECT DISTINCT xxx,xxx,xxx FROM xxx WHERE xxx='xxx' ORDER BY xxx OPEN cur1 FETCH NEXT FROM cur1 INTO @xxx,@xxx,@xxx WHILE @@fetch_status=0 BEGIN -- sql FETCH NE... 阅读全文
摘要:
Step1.将DB脱离可用性组 Step2.修改为简单恢复模式>收缩文件>修改回完整恢复模式 -- Truncate the log by changing the database recovery model to SIMPLE. ALTER DATABASE [DB] SET RECOVERY 阅读全文
摘要:
----恢复9月6号完全备份 RESTORE DataBase [DB] From Disk='D:\BackUp\DB_FULL20150906.BAK' with NORECOVERY, Move 'DB' to 'D:\SQLData\DB_Data.MDF',Move 'DB_log' to 'D:\SQLData\DB_log.LDF' ----恢复9月7号差异备份 RESTORE ... 阅读全文
摘要:
--backup Use [DBName] Declare @FullFileName Varchar(200) Declare @FileFlag varchar(20) Set @FileFlag='20'+convert(char(6),getdate(),12) Set @FullFileName='d:\BackUp\'+@FileFlag+'.BAK' BackUp DataBase... 阅读全文
摘要:
//方法一 下载word Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "Application/msword"; string s = Server.MapPath(WordPath); Response.WriteFile(WordPath); //Response.Write(s); Res... 阅读全文
摘要:
Label1.Text = Play(url, 600, 400); public string Play(string url, int width, int height) { string strTmp = url.ToLower(); if (strTmp.EndsWith(".wmv") || strTmp.EndsWith(".mp4") || strTmp.End... 阅读全文
摘要:
通过Request.QueryString["CheckItem"]的方式调用值的时候,数值中的加号“+”会转换为空格“ ” 例如传输“ABC+EFG”,就会取到“ABC EFG” 解决方法: 使用Server.UrlEncode("数据")方法进行编码,之后QueryString方法会自动解码并返 阅读全文
摘要:
公共Modules定义: Forms中引用: 阅读全文
摘要:
strTypeEx = ReadIniFile("Type", "Type", App.Path & "\set.ini") strTypeEx = Split(strTypeEx, ";") For i = LBound(strTypeEx) To UBound(strTypeEx) CboType.AddItem Trim(strTypeEx(i)) Next i 阅读全文
摘要:
软件运行问题之一:提示部件'COMDLG32.OCX'或其附件之一不能正确使用:一个文件丢失或无效。 或:COMPONENT 'COMDLG32.OCX' OR ONE OF ITS DEPENDENCIES NOT CORRECTLY REGISTERED:A FILE IS MISSING OR 阅读全文