I want to take the rows with a createDate
30 days old and change the bit value IsExpired
to 1
. How do I accomplish this?
Here is the query I have tried:
UPDATE [mydb].[dbo].[mytable]
SET IsExpired = 1
WHERE CreateDate > (time, SYSDATETIME(GETDATE(CreateDate)+30))
The CreateDate
column has a datetime
string stored within it from a C# project. For example the value stored in the first row is 2013-05-29 14:59:48.000
. When I execute it in SQL I get an error
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.