日期:2014-05-18 浏览次数:20569 次
---------------------------- -- Author :fredrickhu(小F,向高手学习) -- Date :2011-09-15 16:08:34 -- Verstion: -- Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0 (Intel X86) -- Apr 22 2011 11:57:00 -- Copyright (c) Microsoft Corporation -- Enterprise Evaluation Edition on Windows NT 6.1 <X64> (Build 7600: ) (WOW64) -- ---------------------------- --> 测试数据:[tb] if object_id('[tb]') is not null drop table [tb] go create table [tb]([col] datetime) insert [tb] select '2011-09-01 21:23:45:233' --------------开始查询-------------------------- update tb set col = '2011-09-01 22:32:13:132' where col = '2011-09-01 21:23:45:233' select * from [tb] ----------------结果---------------------------- /* col ----------------------- 2011-09-01 22:32:13.133 (1 行受影响) */
------解决方案--------------------
update XX set dateCreated = '2011-09-01 22:32:13.132' where dateCreated = '2011-09-01 21:23:45.233'
------解决方案--------------------
DECLARE @TB TABLE(id int,DDate datetime) INSERT INTO @TB(id,DDate) SELECT 1,GETDATE() SELECT * FROM @TB UPDATE @TB SET DDate = '2011-01-01 01:00:02:001' SELECT * FROM @TB
------解决方案--------------------
毫秒最大是999,写4位不是找错吗