November 30, 2008 at 5:53 pm
I have been doing the following for the date format:
convert(varchar,DateColumn,101) + 00:00:00
How can I do the above without concatenating 00:00:00, I do'nt think concatenating is the best way of doing it.
Thanks!
November 30, 2008 at 6:18 pm
If your intent is to strip the time (or zero the time), then try:
SELECT dateadd(day, datediff(day, 0, DateColumn), 0);
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
November 30, 2008 at 6:30 pm
Of course, that still doesn't produce a full string formatted version. Which may or may not have been the OP's intent, it's hard to say....
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
November 30, 2008 at 7:53 pm
Unless the output is directed at a format-defined file, date formatting should be done in the GUI.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 30, 2008 at 10:59 pm
Hi Mh,
Try this....
cast(convert(varchar,cast(datecolumn as smalldatetime),101) as smalldatetime)
Thanks
Shailesh
December 1, 2008 at 4:14 am
shailesh (11/30/2008)
Hi Mh,Try this....
cast(convert(varchar,cast(datecolumn as smalldatetime),101) as smalldatetime)
Thanks
Shailesh
Have you read previous replies? 😉
Failing to plan is Planning to fail
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply