UPDATE TimeRecord
SET activityid = 151
WHERE timevalue >= '13:00:00.0'
When I run the query it updates every record instead of the ones greater than the specified timevalue
The timevalue column is formatted as follows
2012-05-24 13:00:00.0
UPDATE TimeRecord
SET activityid = 151
WHERE timevalue >= '13:00:00.0'
When I run the query it updates every record instead of the ones greater than the specified timevalue
The timevalue column is formatted as follows
2012-05-24 13:00:00.0
Without a date specified, you default to January, 01 1900 13:00:00
, so you're asking to update any value where timevalue
is after that date, which is quite likely all of them.
You probably want to use:
UPDATE TimeRecord
SET activityid = 151
WHERE DATEPART(HOUR, timevalue) > 13;