有没有办法更新表中的所有列
2010-12-31 23:59:59.000
至
2010-12-31 00:00:00.000
像这样的东西??
UPDATE t1
SET [Posting Date] = [Posting Date] with ms = 00:00:00.000
WHERE ms = other than 00:00:00.000
GO
有没有办法更新表中的所有列
2010-12-31 23:59:59.000
至
2010-12-31 00:00:00.000
像这样的东西??
UPDATE t1
SET [Posting Date] = [Posting Date] with ms = 00:00:00.000
WHERE ms = other than 00:00:00.000
GO
UPDATE t1
SET [Posting Date] = cast([Posting Date] as date)
WHERE cast([Posting Date] as time) > '00:00'
UPDATE t1
SET [Posting Date] = CAST([Posting Date] as DATE)
这可能会帮助您:
UPDATE tableName SET ColumnName = CAST( CAST( NOW( ) AS DATE ) AS DATETIME );
在 sq 服务器
UPDATE [dbo].[1] SET [datetime]= CAST([datetime] AS DATE)
select * from [dbo].[1]
尝试:
MODIFIEDDATETIME-(cast(MODIFIEDDATETIME as time))
这对我有用:
update t1 set [Posting Date] = CONVERT(varchar,[Posting Date] , 112)
但我认为它很大程度上取决于您的数据库的语言环境是如何配置的,您可能需要使用另一种样式(而不是 112,也许是 101 或 102...)查看此链接以查看可能的转换样式并选择一个更适合你。
或者,如果您需要这样做一次,您可以将列类型更改为日期,保存然后返回日期时间,但如果表很大,这可能会很耗时