Sql script change
Posted on 2008-06-10
Since we are to keep each question only related to itself I am opening a follow-up question to my earlier SQL Script question.
In short I have a script that runs perfectly right now moving data from one db to another. The only glitch with this script is that it requires the user to change the "before date". I want to apply the fix from my earlier "purge" question to this as well.
Does anyone see a problem going from this:
And changing it to this (wanting the script to move anything more than 12 months old):
set @cutoffdate WHERE [date] < dateadd(month, -12, getdate())
Unfortunately I have no way to test this without actually running the script so I thought it safer to look like an idiot and ask what I am assuming is a pretty obvious question.