Posting Yak Master
Posted - 06/27/2007 : 03:31:50
| Hi Guys,
I realise this is probably a well discussed topic but
recently a colleague asked me about getting only the date part of a date for doing a comparison in a query.
He'd used the following code
to compare the date parts
I've seen various methods of doing this like
select dateadd(day, datediff(day, 0, getdate()), 0)
which is what I tend to use
STR( YEAR( GETDATE() ) ) + '/' +
STR( MONTH( GETDATE() ) ) + '/' +
STR( DAY( GETDATE() ) )
( GETDATE() AS FLOAT )
) AS DATETIME
I was wondering which is the best way of doing this ?
Is there a generally accepted way ?
Or doesn't it matter ?