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 |
|
feelingsheepish
Starting Member
8 Posts |
Posted - 2009-09-01 : 09:19:18
|
| Hi,I would like to be able to select all records from a table where the date is greater than one year from todays date. Can someone show how to go about doing this?The field is in datetime format.Many thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-01 : 09:29:51
|
| where datecol>dateadd(year,1,getdate())MadhivananFailing to plan is Planning to fail |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-09-01 : 09:36:20
|
| shouldn't it be -1?this?where [urcolumn] > dateadd(yyyy,1,datediff(dd,0,getdate()))EDIT : Oops ...sorry..dint notice OP's post saying "one year from today's date" |
 |
|
|
feelingsheepish
Starting Member
8 Posts |
Posted - 2009-09-03 : 05:09:45
|
quote: Originally posted by madhivanan where datecol>dateadd(year,1,getdate())MadhivananFailing to plan is Planning to fail
Thanks, thats great |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-03 : 05:12:57
|
quote: Originally posted by feelingsheepish
quote: Originally posted by madhivanan where datecol>dateadd(year,1,getdate())MadhivananFailing to plan is Planning to fail
Thanks, thats great
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|