December 9, 2008 at 12:33 am
Comments posted to this topic are about the item CURRENT_TIMESTAMP
December 9, 2008 at 8:29 am
So which should I use....
1. GETDATE
or
2. CURRENT_TIMESTAMP
?
Hiding under a desk from SSIS Implemenation Work :crazy:
December 9, 2008 at 8:46 am
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)
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]
December 9, 2008 at 8:58 am
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:
December 9, 2008 at 9:00 am
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()
December 9, 2008 at 9:02 am
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 ?
December 9, 2008 at 9:06 am
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.
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]
December 9, 2008 at 10:13 am
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?
December 9, 2008 at 10:15 am
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.
December 9, 2008 at 10:17 am
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
December 9, 2008 at 10:19 am
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.
December 9, 2008 at 10:23 am
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.
December 9, 2008 at 10:28 am
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?
December 9, 2008 at 10:51 am
I am Steve.
SQL DBA.
December 11, 2008 at 1:31 pm
😛
__________________________________________________
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