Reputation: 8156
I am not sure how to make an automaticed script that incrments all dates in a database. I was asked if the date is Friday, the script needs to increment the next business date to Monday, so I will need some logic in the script.
This can be easily done in C# or any other programming language. But, I was required that the script must be automaticed, identially a native SQL script (*.sql). I am confused whether this is possible at all.
Upvotes: 0
Views: 544
Reputation: 14648
UPDATE yourtable
SET yourdate = dateadd(dd, 3, yourdate)
WHERE datepart(weekday,yourdate)=6
you can manipulate the WHERE clause however you want. It will add 3 days to each date in your database which corresponds to your WHERE clause.
Upvotes: 2