Reputation: 241
I'm trying to perform and update query that updates the date in a database. Please note, I'm using a version of SQL Server older than 2008 so I cannot use the Date type.
UPDATE TABLE
SET TABLE.DATECOLUMN = @input_date
I'm trying to do something like below, I want the date entered to essentially get rid of the time in datetime, so set it to midnight.
UPDATE TABLE
SET DATEADD(d, DATEDIFF(d, 0, TABLE.DATECOLUMN)) = @input_date
Upvotes: 0
Views: 1207
Reputation: 522396
UPDATE TABLE
SET DATECOLUMN = CONVERT(DATETIME, DATEDIFF(DAY, 0, @input_date))
Upvotes: 2