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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 date format for search

Author  Topic 

jaimin
Starting Member

21 Posts

Posted - 2007-07-03 : 09:02:52
hi
i am using a calendar control. the format is mm-dd-yyyy

my table stores date in the following format-
mm/dd/yyyy hh:mm:ss

my search is based only on date(not time). how can i do it?


thanks
Jaimin

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-07-03 : 09:17:45
[code]Where dateadd(day, 0, datediff(day, 0, datecol)) = dateadd(day, 0, datediff(day, 0, @datevar))[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

jaimin
Starting Member

21 Posts

Posted - 2007-07-03 : 09:37:55
hi
are u searching on the base of date difference??
actually, my search is based on startDate. user chooses the startDate from calendar and on button click, the result get displayed in gridview.

can you tell me how should i deal with it??

thanks
Jaimin
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-03 : 09:40:21
Where datecol >= @datevar and datecol < dateadd(day, 1, @datevar)

to use present index


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-07-04 : 00:49:34
www.sql-server-performance.com/fk_datetime.asp

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -