有一个备份表,我想在其中存储1个月的数据,每个月的第一个星期一数据应该被截断
Select * from table A into backup_Table
case when its 1st monday of month
Truncate Table Backup_table
Else
exit
如何计算当前月的第一个星期一
IF
(CAST(DATEADD(WEEK, DATEDIFF(WEEK, 0,DATEADD(DAY, 6 - DATEPART(DAY, GETDATE()), GETDATE())), 0) as date) = CAST(GETDATE() as date))
Truncate Table Backup_table
...