Groups | Blog | Home
all groups > sql server (alternate) > february 2004 >

sql server (alternate) : reformatting DATE


Bill
2/6/2004 5:18:49 PM
I currently have a date column that draws from the now() function in my
asp script. The date looks like this:

2/5/2004 10:09:52 AM

As you can see, there is the day and the time data all in the same
string.

What I would like to do is run a group by clause that groups
all the dates that are on the same day togeather. But how do I seperate
this data in SQL? I know there are VB functions that can do this, but in
order for the group function to work when running a sql statement, I
have to do it in SQL itself. Does anyone know how this is done?

Thank you!

Bill

*** Sent via Developersdex http://www.developersdex.com ***
Simon Hayes
2/6/2004 6:50:11 PM

[quoted text, click to view]

I'm not completely sure what you're looking for, but perhaps something like
this?

select convert(char(8), DateColumn, 112) as 'Day', sum(SomeColumn) as
'Total'
from dbo.MyTable
group by convert(char(8), DateColumn, 112)

Simon

AddThis Social Bookmark Button