|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, December 15, 2011 9:08 AM
Points: 34,
Visits: 132
|
|
I was using Method 4, saw this post and was an immediate convert to Method 1 till I saw Method 3, the simplest yet, and as it turns out, the fastest! But nothing beats the simplicity of TRUNC(sysdate) - a PL/SQL function I really miss.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, December 07, 2012 9:54 AM
Points: 1,
Visits: 286
|
|
| 0.25 should be 6AM, right? Not 4AM.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: 2 days ago @ 11:17 AM
Points: 46,
Visits: 206
|
|
Our inhouse method of doing this for today's date is: DATEDIFF(d, 0, GETDATE()) or for a general date from the DB: DATEDIFF(d, 0, DateField)
DATEDIFF may be more expensive, but is it more expensive than "CAST(FLOOR(CAST("?
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 11:18 AM
Points: 848,
Visits: 1,453
|
|
For what its worth.... from my 'T-SQL Shortcuts' scripts I found the following:
/*Per SQL GURU Itzah-Ben Gah the fastest way to extract the date portion of a DateTime value is:*/ SELECT CONVERT(DATETIME,Floor(Convert(FLOAT, GetDate() ) ) )
I don't recall if Itzah was referring to a SQL Serve 2XXX specific platform or T-SQL in general and I did not note anything about specific SQL versions along with this shortcut.
Kindest Regards,
A Democracy works great until the day you find yourself on the sheep side of a vote between 5 wolves and 4 sheep on what’s for dinner when neither have eaten in many days. A free Republic where the rights of the few and the individual are protected is the only one in which Freedom and Prosperity for all have a chance to blossom.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, October 09, 2012 2:11 PM
Points: 128,
Visits: 159
|
|
Am I the only one who noticed this error in the original article?
> with right section of the decimal point representing > number of dates since 01-Jan-1900
"right section of the decimal point" should read either "left of the decimal point" or "whole number portion."
|
|
|
|