Datetime data type….. | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Datetime data type…..

Hi has anyone came across the problem I have with the DateTime data type…. Basically, I have a column which has been created with the datetime datatype with a length of 8. When I return data using query analyzer I get for example, 2005-03-04 15:00:51.187, however when I return the same value via Enterprise Manager I get 2005-03-04 15:00:51 Why when using EM do I lose the .187 from the time?? Thanks

If you copy the datefield from EM, you will get
4/15/2005 12:42:59 PM
It will store PM or AM
To get millisecods, you need to query it
There is no need to copy data from EM
Madhivanan Failing to plan is Planning to fail
Thanks Madhivanan, However I’m not sure this slves my problem… EM stores the results as 2005-03-04 15:00:51.587 there is no PM or AM. EM is also rounding the results up eg. Query Analyzer shows the value as 2005-03-04 15:00:51.587, however EM rounds this to 2005-03-04 15:00:52
It doesnot matter how it is stored in the table
But when retrieving it, format it to get required result
In your case there is no need to worry about it as you get the correct result when querying it
Madhivanan Failing to plan is Planning to fail
date time is stoed in float when it displays it will be in different formats
No, it is no FLOAT. If the first article suggests this, then this is wrong!<br />A DATETIME will store data as BINARY(<img src=’/community/emoticons/emotion-11.gif’ alt=’8)’ />. It will store miliseconds. The difference between QA and EM is merely presentational. You really shouldn’t use EM to view your data.<br /><br />–<br />Frank Kalis<br />Microsoft SQL Server MVP<br /<a target="_blank" href=></a><br />Ich unterstütze PASS Deutschland e.V. <a target="_blank" href=></a>) <br />
Well, frank thank you for corecting me I read this some where