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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Reliably adding milliseconds to a date.

Author  Topic 

aclarke
Posting Yak Master

133 Posts

Posted - 2001-08-16 : 13:23:51
I'm trying to do this: dateadd(millisecond, 1, @someDate). However, this doesn't add 1 millisecond to the date in question. Generally it doesn't add anything (noticeable). Same thing with 2 or 3, sometimes they'll add what I ask, sometimes something else. I need the next millisecond before or after a given date. I can of course use datepart(milliseconds, @someDate) + 1 and that works fine but that's a lot of branches to deal with seconds, minutes, hours, days, years.

Is there another way to do this? I'm surprised that I can't add milliseconds this way.

I'm using SQL Server 2000 sp2 but it's going to have to run on v.7

Thanks,
- Andrew.

   

- Advertisement -