This question is better posted in microsoft.public.sqlserver.programming.
however, here is how you would get the date and time parts.
select [datepart]=convert(varchar(10),datetimecolumn,
101),timepart=convert(varchar(10),datetimecolumn, 108) from datetimetable
3) select Monthpart=datepart(m,datetimecolumn),
Yearpart=datepart(yy,datetimecolumn) from datetimetable
4) select MilliSecondspart=datepart(ms,datetimecolumn),
Yearpart=Minutespart(mi,datetimecolumn) from datetimetable
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com "Wendy Elizabeth" <WendyElizabeth@discussions.microsoft.com> wrote in
message news:1166B434-ADD1-4AAD-BA56-0C3DC5A0D31C@microsoft.com...
[quoted text, click to view] > I just started to work with sql server 2000. I want to write a query
>
> against "datetime" columns in the sql server 2000 database. I am to be
>
> able to do the following with the sql server 2000 "datetime" columns:
>
> 1. Be able to access the date portion only.
> 2. Be able to access the time portion only.
> 3. Be able to access only a portion of the date like the month and/or
>
> year only.
> 4. Be able to access only a portion of the time like the milliseconds
>
> and/or the minutes.
>
> What kind of query statements would I need to write, to be able to
>
> access only a portion of "datetime" columns?
>
> Thanks!
>