gpt4 book ai didi

sql - 如何更新 T-SQL 中的日期时间字段?

转载 作者:行者123 更新时间:2023-12-01 17:17:57 25 4
gpt4 key购买 nike

以下查询不会更新日期时间字段:

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com