我收到错误消息:必须声明标量变量“ @dCutOff”。
我有以下脚本,我无法将DATE值(@dCutOff)传递给脚本2)和3):
USE [V3]
GO
DECLARE
@dCutOff Datetime,
@lDelete Bit
--Set the date date according to your cut off date
SELECT @dCutOff = CAST('01/01/2009' AS DATE)
SELECT * INTO TABLE040BKUP FROM TABLE040
SELECT * INTO TABLE41BKUP FROM TABLE041
DROP TABLE ADVANCED.TempTABLE041
--1) delete customer/account = blank
DELETE FROM Table003 WHERE C_UNO='' AND C_DOS=''
GO
--2) Table007
DELETE FROM Table007 WHERE T_DATETIME < @dCutOff
GO
--3) Table008
DELETE FROM Table008 WHERE T_DATETIME < @dCutOff
GO