Delete large amount of data from a table

Delete large amount of data from a table 刪除大量資料作法 Method 1 若刪除完成之後留下的資料較多的話(例如要刪除1/3的資料),就用WHILE DELETE top語法來刪除  declare @n int  while 1=1  begin  DELETE top(2000)  FROM dbo.BigTable  WHERE time <= ‘2013-09-03 22:00:00.000’  OPTION(MAXDOP 1) — 可考慮是否只使用一個CPU來執行刪除動作  set @n=@@ROWCOUNT  if @n<2000  break  end Method 2 若留下的資料比較少(例如要刪除2/3的資料或更多的資料),就可以考慮INSERT INTO再TRUNCATE或INSERT INTO再RENAME INSERT INTO and TRUNCATE 1.將要保留的資料INSERT INTO到dbo.Temp_BigTable SELECT * INTO dbo.Temp_BigTable FROM…

0

VBScript Common Constants

VBScript Common Constants 1.FileSystemObject ‘For FileSystemObject Const ForWriting      = 2 Const ForAppending   = 8 Const ForReading     = 1 Const OpenAsDefault = -2  ‘ Opens the file using the system default. Const OpenAsUnicode = -1  ‘ Opens the file as Unicode. Const OpenAsUSAscii =  0  ‘ Opens the file as ASCII. Const DontCreate =  False ‘…

0

Microsoft VBScript

Microsoft VBScript resource VBScript相關資源 Quick Start: VBScript Operators https://msdn.microsoft.com/en-us/library/9da4s2eh(v=vs.84).aspx   ‘ default value of variable is “” or Empty or 0 Dim p1 If p1 = “” Then  Wscript.Echo “p1=””””” End If If p1 = 0 Then  Wscript.Echo “p1=0” End If If isEmpty(p1) Then  Wscript.Echo “isEmpty(p1)” End If ‘ default value is not null If…

0

Using SQL Server in Windows 8 and later versions of Windows operating system

Using SQL Server in Windows 8 and later versions of Windows operating system 在Windows 8與更新版的Windows作業系統使用SQL Server 雖然KB2681562文件說明Windows 10不支援SQL 2008 R2 但經過測試在Windows 10安裝SQL 2008 R2只會跳出警告,最後還是可以安裝成功 ,但此種搭配微軟並不支援,將來也不會有hotfix Using SQL Server in Windows 8 and later versions of Windows operating system https://support.microsoft.com/en-us/kb/2681562 OS version SQL version Minimum SQL Server version requirements Windows 10 SQL 2014 Support SQL Server…

0