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
 Transact-SQL (2000)
 Milliseconds confusion

Author  Topic 

nemohm
Yak Posting Veteran

69 Posts

Posted - 2003-06-23 : 12:53:28
Hello,

There is a column that returns different data, depending on the place of query.

1.When I open the table in EM data looks like:


6/18/2003 5:22:15 PM

2.In Query Analyzer:

Select (utc) from events

2003-06-19 23:26:35.700

select max(time1) as time, max(utc) as utc from EventsAPCPSA

time utc

127005387957018750 2003-06-19 23:26:35.700


3.When I attempt to get only milliseconds:

select substring(cast(utc as char(30)), 20, 3)
from EventsAPCPSA

---no return---



select substring(cast(utc as char(30)), 18, 3)
from EventsAPCPSA

PM



Are there any milliseconds, and is there a way to get only the millisecons ?

Thx,

Dobby





X002548
Not Just a Number

15586 Posts

Posted - 2003-06-23 : 13:35:35
How does:


SELECT RIGHT(Convert(varchar(26),GetDate(),121),3)


Float your boat?



Brett

8-)
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2003-06-23 : 14:47:26
Dates aren't floats
SELECT DATEPART(ms, GETDATE())


Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-06-23 : 15:04:03
Well, they're DWORDS, so close enough


Edited by - setbasedisthetruepath on 06/23/2003 15:04:30
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-06-23 : 16:44:44
quote:

Dates aren't floats
SELECT DATEPART(ms, GETDATE())



[homer]Dooooohh[/homer]

Datepart, but of course...



Brett

8-)
Go to Top of Page
   

- Advertisement -