以下查询不会更新日期时间字段:
update table
SET EndDate = '2009-05-25'
WHERE Id = 1
我也尝试过不使用破折号,但这也不起作用。
最佳答案
如有疑问,be explicit about the data type conversion using CAST/CONVERT :
UPDATE TABLE
SET EndDate = CAST('2009-05-25' AS DATETIME)
WHERE Id = 1
关于sql - 如何更新 T-SQL 中的日期时间字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3144074/