开发者

Setting A Date to End the Use of a Section of a SQL Script

开发者 https://www.devze.com 2022-12-18 11:05 出处:网络
I am using SQL 2005.For one of our customers, we run a script everytime we set-up a new database开发者_高级运维.The script defines what information remains and what information is deleted from the dat

I am using SQL 2005. For one of our customers, we run a script everytime we set-up a new database开发者_高级运维. The script defines what information remains and what information is deleted from the database....we use a master database to set 'typical' default information. I have been asked to add a delete statement to the script with a 'test' for the delete statement to quit running automatically after 1 January 2011. We don't want any other information if the script affected; just the one statement. Does anyone know how to structure the syntax for this kind of request?

Thank you.


IF GETDATE() < '20110101'
BEGIN
--Deletez
END

You may need to cast, but i don't think so CAST('20110101' AS DATETIME)

0

精彩评论

暂无评论...
验证码 换一张
取 消