Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Ciupaz
Posting Yak Master
232 Posts |
Posted - 2011-12-19 : 10:01:13
|
| Hi all,having a simple UPDATE, like this:UPDATE dbo.Table1SET UpdateDate = GETDATEWHERE ID BETWEEN 1 AND 10is it possible to have the UpdateDate fild with datetime values always different (a millisecond it's enough).Thank you.Luigi |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2011-12-19 : 10:23:39
|
An odd requirement.As datetime is only accurate to 3.333... ms, something like the following should work:UPDATE dbo.Table1SET UpdateDate = DATEADD(ms, ID * 4, CURRENT_TIMESTAMP)WHERE ID BETWEEN 1 AND 10 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-19 : 11:03:27
|
| if you want more accuracy use datetime2------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Ciupaz
Posting Yak Master
232 Posts |
Posted - 2011-12-19 : 14:00:35
|
| Thanks a lot, in this way is perfect.Luigi |
 |
|
|
|
|
|