capture seconds in smaldatetime

  • One of my script log the events in a smalldatetime filed.

    But some reason it is not writing seconds.All it writes 2005-12-08 20:12:00.000.

    How do I capture seconds also.

  • try converting it to datetime..."select convert(datetime, fldSmallDateTime)"







    **ASCII stupid question, get a stupid ANSI !!!**

  • Change the field to datetime. In smalldatetime you already lost the sec information.

    DECLARE @myDate  DATETIME

    DECLARE @mySmallDate SMALLDATETIME

    SELECT @myDate = GETDATE(), @mySmallDate = GETDATE()

    SELECT GETDATE() myGETDATE,

     @myDate myDate,

     @mySmallDate mySmallDate,

     CONVERT(DATETIME, @mySmallDate) LostSecondsInSmallDate

    Regards,
    gova

  • SmallDateTime stores date/time value accurate to the minute

    DateTime stores date time values accurate to 3 milliseconds.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply