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 |
|
ranganathanmca
Starting Member
15 Posts |
Posted - 2011-08-31 : 02:59:07
|
| Hi Guys., I have to find out DATE from start date & end date,i am getting input from the user date i need to find out if start date & end date in between date is there are notExample date start Date End Date 08/01/2011 08/10/2011 08/15/2011 08/25/2011Please guide to reslove this problemThanksranganathan palanisamy |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-08-31 : 03:03:03
|
[code]SELECT *FROM yourtableWHERE start_date <= @user_dateand end_date >= @user_date[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-31 : 03:07:44
|
or is it?SELECT *FROM yourtableWHERE @User_date BETWEEN start_date AND end_date ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-08-31 : 04:15:11
|
It depends. If StartDate and EndDate are of datetime datatype, the two queries above will work.If not, you need to convert the two columns to DATE before doing anything else. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|