Whats the difference between getDate() & CURRENT_TIMESTAMP?

I'm inserting records into an archival table and need to stamp each row with the current time. I have a column called "ArchiveDate" and I hard-code 'CURRENT_TIMESTAMP' in my INSERT statement. Is there a difference if I use getDate() ?

more ▼

asked Oct 26 '09 at 11:00 AM in Default

Slick84 gravatar image

1.3k 75 102 142

(comments are locked)
10|1200 characters needed characters left

2 answers: sort oldest

CURRENT_TIMESTAMP is the ANSI standard method for getting date & time while GETDATE() is the T-SQL method. Also GETDATE() returns the datetime specific to the database including the database time zone offset where as CURRENT_TIMESTAMP doesn't include the database offset.

more ▼

answered Oct 26 '09 at 11:07 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
91k 19 21 74

(comments are locked)
10|1200 characters needed characters left

Great answer, Grant. This is an interesting link if you're looking at CURRENT_TIMESTAMP and GetDate()...


more ▼

answered Oct 26 '09 at 11:26 AM

Aaron Alton gravatar image

Aaron Alton
565 2

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Oct 26 '09 at 11:00 AM

Seen: 6312 times

Last Updated: Oct 26 '09 at 11:46 PM