CURRENT_TIMESTAMP

  • Comments posted to this topic are about the item CURRENT_TIMESTAMP

  • So which should I use....

    1. GETDATE

    or

    2. CURRENT_TIMESTAMP

    ?

    Hiding under a desk from SSIS Implemenation Work :crazy:

  • Which one should you use?

    Simple, look at both values and you'll see the difference. I guess the correct answer to your questions is that it depends what you want the value for.

    --------------

    After more reading I have to retract the above comment. Looks like they're both return the same thing. (see below)



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • I quote

    This function is the ANSI SQL equivalent to GETDATE.

    as definded by MSDN

    and in the table on

    http://msdn.microsoft.com/en-us/library/ms186724.aspx#DateandTimeFunctions

    There is no difference in definition of the return of the functions.

    Using an ANSI Standard function is possibly a good thing to do, makes things less DB specific i.e the SQL is portable.

    However typing less characters may have merit.

    --Shaun

    Hiding under a desk from SSIS Implemenation Work :crazy:

  • looked at both values:

    select current_timestamp, getdate()

    2008-12-09 10:56:40.4772008-12-09 10:56:40.477

    Didn't notice any difference... According to BOL current_timestamp is an equivalent of getdate().

    The only difference is that current_timestamp is a part of ANSI 92 and getdate() is an heritage of old Sybase code. So, you can consider that sometimes in a later releases getdate() will be removed. From that prospective you might want to consider using current_timestamp instead of getdate()

  • Alvin Ramard (12/9/2008)


    Which one should you use?

    Simple, look at both values and you'll see the difference. I guess the correct answer to your questions is that it depends what you want the value for.

    I couldnt see any noticable difference between the two, can you expand a bit more on this ?

  • After reading:

    "Returns the current database system timestamp as a datetime value without the database time zone offset."

    I thought there would be a difference, because of the reference to the time zone offset. But then I read "This function is the ANSI SQL equivalent to GETDATE."

    I'm starting to wonder if one may be going away in future versions.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Alvin Ramard (12/9/2008)


    I'm starting to wonder if one may be going away in future versions.

    Not for a long time I hope, GETDATE() and GETUTCDATE() are too widely used

    I rarely use CURRENT_TIMESTAMP, oops

    Speaking of which, what's the equivalent of GETUTCDATE() in ANSI?

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005
  • Both getdate() and CURRENT_TIMESTAMP returns same value. So, why two functions for same result?

    Can some one describe diff. between both function?

    SQL DBA.

  • SanjayAttray (12/9/2008)


    Both getdate() and CURRENT_TIMESTAMP returns same value. So, why two functions for same result?

    Can some one describe diff. between both function?

    CURRENT_TIMESTAMP is ANSI code

    GETDATE is not.

    Like the difference between CAST and CONVERT i guess

  • Jerry Hung (12/9/2008)


    Alvin Ramard (12/9/2008)


    I'm starting to wonder if one may be going away in future versions.

    Not for a long time I hope, GETDATE() and GETUTCDATE() are too widely used

    I rarely use CURRENT_TIMESTAMP, oops

    Speaking of which, what's the equivalent of GETUTCDATE() in ANSI?

    But, GETUTCDATE() function is to get GMT (Greenwich Mean Time), right.

    SQL DBA.

  • steveb (12/9/2008)


    SanjayAttray (12/9/2008)


    Both getdate() and CURRENT_TIMESTAMP returns same value. So, why two functions for same result?

    Can some one describe diff. between both function?

    CURRENT_TIMESTAMP is ANSI code

    GETDATE is not.

    Like the difference between CAST and CONVERT i guess

    SQL Server 2008 Books Online (December 2008)

    CURRENT_TIMESTAMP (Transact-SQL)

    Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.

    SQL Server 2008 Books Online (December 2008)

    GETDATE (Transact-SQL)

    Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.

    Above statements are from 2008 BOL and explanation is same for both.

    SQL DBA.

  • SanjayAttray (12/9/2008)


    steveb (12/9/2008)


    SanjayAttray (12/9/2008)


    Both getdate() and CURRENT_TIMESTAMP returns same value. So, why two functions for same result?

    Can some one describe diff. between both function?

    CURRENT_TIMESTAMP is ANSI code

    GETDATE is not.

    Like the difference between CAST and CONVERT i guess

    SQL Server 2008 Books Online (December 2008)

    CURRENT_TIMESTAMP (Transact-SQL)

    Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.

    SQL Server 2008 Books Online (December 2008)

    GETDATE (Transact-SQL)

    Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.

    Above statements are from 2008 BOL and explanation is same for both.

    Does this mean that you are agreeing with me, or disagreeing?

  • I am Steve.

    SQL DBA.

  • 😛

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 15 posts - 1 through 15 (of 17 total)

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