Wednesday, March 21, 2012

Datetime problem

this is how the data stored in DB month/day/year hh:mm:ss

when i try to query it using :

select count(*) from table where convert(datetime, convert(varchar(10), datetime, 103),103) >= '01/03/2006'

Do i need to follow back ">=month/day/year" ? Since i have convert it to 103 ?

Thanks

How about doing it with a stored procedure?

DECLARE @.mydate_sm SMALLDATETIME
SET @.mydate_sm = '3/2/2006'

SELECT *
FROM dateTest
WHERE (datenow < @.mydate_sm)

|||You called your field "datetime"?sql

No comments:

Post a Comment