Re: Loss of Precision in DateTime

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 07/19/04


Date: Mon, 19 Jul 2004 09:51:16 -0400

How are you verifying it? ARe you looking in Enterprise manager or QA? If
it's showing in EM like that - it's not a problem - to verify it, do a
SELECT WhateverColumn from yourTable in QA and you should see the times as
well. If it's a varchar or something you could have a problem, but if it's
DateTime - it can't physically be stored without the Time although it may
'look' like it. If it's showing that way client side, again it may well
just be a formatting issue. So check the datasource(datatable or
datareader) and see that the actual value is before you check the contorl or
UI tool that's displaying it.

HTH,

Bill

-- 
W.G. Ryan, eMVP
Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
"James" <jtaylor1024@hotmail.com> wrote in message
news:f2d8a605.0407190515.396adc1c@posting.google.com...
> For some reason when I pass a .net datetime value to a sqlType
> DateTime to a smalldatetime in sql server, any value that happens to
> fall at exactly midnight drops the time portion and only stores the
> date?  If I trace or do any sort of ToString() on any of the values
> during the process in the app, it shows the time correctly, but when I
> look in the db I only see the date...
>
> DateTime lastDate = new DateTime(2004,1,1,0,0,0);
>
> // Snip set db access obj
> db.daLastAccessedDate   = new SqlDateTime(lastDate);
>
> // Snip set sp parameter
> scmCmdToExecute.Parameters.Add(new SqlParameter("@LastAccessedDate",
> SqlDbType.SmallDateTime, 4, ParameterDirection.Input, false, 16, 0,
> "", DataRowVersion.Proposed, m_daLastAccessedDate));
>
> // nothing fancy in sql server -- only a smalldatetime.
>
> Has anyone else seen this?  I really don't want to kludge this by
> adding one minute or something...
>
> James


Relevant Pages

  • Re: Date format
    ... select * from #tmp ... > This will not work because the fiel I'm loading the data> into is a datetime datatype. ... >>If you want the time portion also, you want to use> different style like 100. ... How can I have this showing the actual time ...
    (microsoft.public.sqlserver.programming)
  • Re: Loss of Precision in DateTime
    ... When using the query pane in EM you don't see the time ... > How are you verifying it? ... > DateTime - it can't physically be stored without the Time although it may ... > Have an opinion on the effectiveness of Microsoft Embedded newsgroups? ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Advice on the style to use in imports
    ... importing modules. ... I'm showing what I used in my current project, ... from pprint import pprint # Because pprint.pprint is just redundant ... from datetime import datetime # This might be a bad idea... ...
    (comp.lang.python)
  • Re: Help with a (hopefully famous) quote
    ... just can't seem to retrace it (or Google-it). ... "A proof is not so much about showing that something is true but WHY ... statement is simply and blatantly false. ... "Understanding a proof is not so much about verifying that something ...
    (sci.math)
  • Re: Use of Interval Datatype
    ... error in the wrong place (the interval column when it was the datetime ... '11:19:03' to DATETIME HOUR TO MINUTE ... showing 5 digits for the years). ...
    (comp.databases.informix)