Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date Format
Message
From
30/04/2003 12:19:11
 
 
To
30/04/2003 10:58:55
Alvin Lourdes
Children and Youth Services Cluster
Toronto, Ontario, Canada
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00783178
Message ID:
00783228
Views:
19
>I would like to return only the full date portion of this field.

SQL Server only has a datetime datatype. You will always have a time componenet.

DECLARE @d datetime
SET @d = '20030429'
SELECT @d

You see that the time component is set to 12:00am

>When I perform a search on this field... if I look for 04/11/2003 will I get the appropriate row?

Since there is only a date, SQL Server will default the time component to 12:00am. The only rows that will be matched are those who's value is set to 4/11/2003 12:00am.

I perfer to use the following when searching on dates:

datetimecolumn >= '20030411' and datetimecolumn < '20030412'

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform