Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing datetime to the millisecond ?
Message
From
23/01/2003 10:20:34
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00744572
Message ID:
00744727
Views:
8
The inserted_on column is a datetime as are all dates in the system. Running the following returns my version:
SELECT @@Version

Microsoft SQL Server  2000 - 8.00.194 (Intel X86)   Aug  6 2000 00:57:48 
 Copyright (c) 1988-2000 Microsoft Corporation  Standard Edition on Windows NT 5.0 
(Build 2195: Service Pack 2) 
The inserted_on column uses a default value of (GETDATE()). I do agree when running the below select with a CONVERT(VARCHAR(32),GETDATE(),121) does return the milliseconds.

The question still remains as to why the milliseconds are not stored in the datetime columns of my table. What else could it be?

>I'm working with Sql2000 and don't see this. What version are you using? What your select would return if you substitute INSERTED_ON with datetime variable with value of GETDATE()? Are you using datetime or smalldatetime data type? The second one doesn't store millisecond portion of the time.
>
>>Sergey, thanks for the reply. When I ran a query using your suggestion and some other techniques I am NOT seeing the millisecond portion of the datetime value.
>>
>>
>>SELECT
>>CONVERT(VARCHAR(32), INSERTED_ON, 121) AS cnv_121,
>>CONVERT(float, INSERTED_ON) AS float,
>>CONVERT(varchar, INSERTED_ON, 109) AS cnv_109
>>FROM tbl
>>
>>cnv_121                   float              cnv_109
>>-----------------------   ----------------   --------------------------
>>2003-01-22 16:04:33.000   37641.6698263889   Jan 22 2003  4:04:33:000PM
>>2003-01-22 16:04:33.000   37641.6698263889   Jan 22 2003  4:04:33:000PM
>>2003-01-22 16:04:33.000   37641.6698263889   Jan 22 2003  4:04:33:000PM
>>...
>>2003-01-22 16:05:02.000   37641.670162037    Jan 22 2003  4:05:02:000PM
>>
>>
>>Any ideas why this would be the case? Hard to believe that every insert happens when the millisecond value is at 000. However, that is the case for all 3,904 rows in this particular table.
>>
><snip>
Previous
Reply
Map
View

Click here to load this message in the networking platform