|
Posted by Roy Harvey on 10/02/78 11:54
On Thu, 03 Aug 2006 01:24:48 GMT, "Dan Guzman"
<guzmanda@nospam-online.sbcglobal.net> wrote:
>Whether or not one technique is cleaner than the other is fairly subjective
>but the DATEPART/DATEADD method Roy suggested probably will perform better
>than CONVERT.
I always used to strip off the time by converting to a character
string. I only learned the DATEADD/DATEDIFF approach recently from
reading the SQL Server newsgroups. I am told it is far more
efficient, but I am still trying to decide if it is readable. But I
have had to create some real messes with character strings and
DATEPART and such too.
I still haven't really accepted the simple date arithmatic: SET
@datetime2 = @datetime1 + 2 from your example. I know it works in
days, but I like the explicit unit DAY in DATEADD. I don't even
bother to use the abbreviations in DATEADD, DATEPART or DATENAME any
more, as I find the full word more explicit.
Roy
Navigation:
[Reply to this message]
|