Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-03-07 : 21:42:23
|
hi all In my SP, i have a date column, whcih gives dates.. Unfortunately some dates are long dates(with time) and some are short(with dates) How can i truncate this long date, to short in SP Thanks in advance |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-07 : 21:51:26
|
i assume the date column is of datetime datatype ?use dateadd(day, datediff(day, 0, datecol), 0) to remove the time. KH |
 |
|
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-03-07 : 21:57:33
|
Thanks for the reply.Actually my select stmt in SP is like thisSELECT COUNT(dbo.Ship.[Ship Date]) AS ShipmentsCount, dbo.Ship.[Ship Date] AS [Ship Date]i am getting ship date as2007-01-02 00:00:00i just want 2007-01-02How can i add your idea here?Thanks |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-07 : 21:59:26
|
why don't you do the formatting in your front end application ? KH |
 |
|
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-03-07 : 22:06:06
|
I also thought about that.But we are displaying some charts from these sp.so better if we can avoid time, and reduce the density of charts!!!!IS this not possible in SP? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-07 : 22:18:25
|
yes. it is possible. use convert()convert(varchar(10), datecol, 121) KH |
 |
|
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-03-07 : 22:26:56
|
Thanks IT workedGREAT HELP |
 |
|
|
|
|
|
|