Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
In my table I have 2 fields Id and DateHow can I select all the Ids from my table which are in a given date, with out using betweenThanks and Regards Anu Palavila
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2009-05-08 : 03:12:31
What's wrong with using BETWEEN ? You can use >= or > with <= or < instead of BETWEENKH[spoiler]Time is always against us[/spoiler]
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2009-05-08 : 14:11:21
seems like an interview question
WHERE YourDate >= DATEADD(dd,DATEDIFF(dd,0,Yourdatevalue),0)AND YourDate< DATEADD(dd,DATEDIFF(dd,0,Yourdatevalue)+1,0)