Converting timestamp to datetime

  • This statement works with SS2000 on my development PC,

    but not on my production server as of today.

    Select convert(datetime,@@dbts)

    I get the following error message:

    Syntax error converting datetime from binary/varbinary string.

    Any suggestions?

     

  • @@dbts is not a datetime.  It is only a unique number generated by sql server.

    Check out GetDate() for the current_timestamp

  • I understand @@dbts returns a timestamp.  Up until today, I could run the statement (and I can still run it on a couple other SS2000 instances on other machines).

    Further investigation shows that I only cannot run it in query analyzer for one of the databases - the others work.

  • Must have gone out of range of the datetime datatype... or a date setting has changed (but I'd go with the datetime limit).

    And just to make sure we are on the same page :

    @@DBTS returns the current database's last-used timestamp value. A new timestamp value is generated when a row with a timestamp column is inserted or updated.

     

    @@DBTS is not a date in any way.

  • Thanks for the info  Ninja's_RGR'us

    I believe you are correct that it is a datetime limit - thus it works in other databases (and instances).

     

  • An equivalent to GETDATE() is

    CURRENT_TIMESTAMP

     


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 6 posts - 1 through 6 (of 6 total)

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