为存储过程创建条件 [英] Create a condition for stored procedure
本文介绍了为存储过程创建条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if i want to create a procedure to truncate 12months old records in a table what could be the condition...?
like Set Month = Dateadd(month, -12, Dateadd(day, -1, @intr).
can you suggest..?
推荐答案
尝试:
Try:
DELETE FROM MyTable WHERE MyDate < DATEADD(year, -1, GetDate())
这篇关于为存储过程创建条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文