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.
Author |
Topic |
bernike
Starting Member
1 Post |
Posted - 2013-11-15 : 04:17:22
|
Hi, Im new to sql server and have a problem with date filter.i have table like this:----------------------------------| shift | date 1 | date 2 |==================================| SI | 01/01/13 | 31/01/13 |----------------------------------| SII | 01/02/13 | 28/02/13 |----------------------------------| SIII | 01/03/13 | 31/03/13 |----------------------------------what is the syntax to get the Shift on 05/02/13? |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-11-15 : 05:25:22
|
DECLARE @date DATE = '05/02/13' -- Input dateSELECT *FROM TableNameWHERE @DATE BETWEEN date1 AND date2refer this link for implementing different types of date range filters in sql serverhttp://visakhm.blogspot.in/2012/12/different-ways-to-implement-date-range.html--Chandu |
 |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-15 : 06:00:11
|
quote: Originally posted by bandi DECLARE @date DATE = '05/02/13' -- Input dateSELECT *FROM TableNameWHERE @DATE BETWEEN date1 AND date2refer this link for implementing different types of date range filters in sql serverhttp://visakhm.blogspot.in/2012/12/different-ways-to-implement-date-range.html--Chandu
Always try to pass date values in unambigous format.See thishttp://visakhm.blogspot.com/2011/12/why-iso-format-is-recommended-while.htmldepending on your server settings the above date can be interpreted as 5th Feb 2013,2nd May 2013 0r 13th Feb 2005 so better not to rely upon that. ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|