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 |
|
rnelsch
Starting Member
31 Posts |
Posted - 2012-03-09 : 14:33:07
|
| So I am very new to SQL, though I've worked a lot with queries in the past. I am also new to this forum, so hello everyone! I am using the following to query a table to get same day info= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) Is there something I can add to that to get the next 3 days without specifying a date range?Ryan A Nelsch |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-03-09 : 14:54:04
|
| [code]yourDateCol >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) AND yourDateCol < DATEADD(day, 3+DATEDIFF(day, 0, GETDATE()), 0) [/code]There is also the BETWEEN keyword that you could use, but that is not really appropriate in this case. |
 |
|
|
rnelsch
Starting Member
31 Posts |
Posted - 2012-03-09 : 15:27:28
|
| You are my hero!Ryan A Nelsch |
 |
|
|
|
|
|
|
|