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 |
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2009-01-08 : 04:58:10
|
| Hi GuysI have the following WHERE clause in my statement:WHERE r.dateentered BETWEEN @StartDate AND DATEADD(d,+1,@EndDate).The thing I am trying to achieve is changing the DATEADD(d,+1,@EndDate) to show the @EndDate plus 23 hours and 59 seconds, instead of one day.Is this possible to do?Thanking you in advance |
|
|
Jai Krishna
Constraint Violating Yak Guru
333 Posts |
Posted - 2009-01-08 : 05:01:09
|
| U can do this by adding seconds or minutes to the date @enddateJai Krishna |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-08 : 05:01:25
|
| try thisselect * fromtableWHERE r.dateentered BETWEEN @StartDate AND DATEADD(s,-1,@EndDate+1) |
 |
|
|
Jai Krishna
Constraint Violating Yak Guru
333 Posts |
Posted - 2009-01-08 : 05:03:55
|
| WHERE r.dateentered BETWEEN @StartDate AND DATEADD(s,86399,@EndDate).Jai Krishna |
 |
|
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2009-01-08 : 05:05:52
|
| Thanks Guys!!! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-08 : 05:23:07
|
select * fromtable1WHERE r.dateentered BETWEEN @StartDate AND @EndDate + '23:59' E 12°55'05.63"N 56°04'39.26" |
 |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-01-08 : 05:39:00
|
| if u want to add 59 minutes in your query then u use peso sir suggestion like..select * fromtable1WHERE r.dateentered BETWEEN @StartDate AND @EndDate + '23:59'and if u want to add 23 hours and 59 SECONDS then u use as same but with a bit changes...select * fromtable1WHERE r.dateentered BETWEEN @StartDate AND @EndDate + '23:00:59'Thanks.... |
 |
|
|
|
|
|