sql server change time in datetime


I have a datetime field in the format 2015-04-23 14:00:00.000 in a SQL Server 2005 database and I want change the time on 400 rows by an hour less. So for example 2015-04-23 14:00:00.000 becomes 2015-04-23 13:00:00.000 etc.

I need a sql statement that will update these 400 rows to an hour less than the one that has been recorded.

An help would be greatly appreciated.
Who is Participating?
Vitor MontalvãoMSSQL Senior EngineerCommented:
UPDATE TableNameHere
SET DateColName = DATEADD(hh,-1,DateColName)
WHERE TypeYourCriteriaHere

Open in new window

bootneck2222Author Commented:
Excellent. Thank you Vitor
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.