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 |
|
Freddie
Starting Member
29 Posts |
Posted - 2006-03-29 : 13:32:29
|
| Hello:Can you help me generate dates into a table going back 3 years based on getdate().Muchas Gracias. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-29 : 13:45:55
|
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519Go with the flow & have fun! Else fight the flow Blog thingie: [URL="weblogs.sqlteam.com/mladenp"] |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-03-29 : 15:30:15
|
Check whether the following helps uDeclare @t table(d Datetime)Declare @i int, @ld intSet @i = 0Set @ld = 3 * 365while @i < @ld Begin Insert into @t values(getdate()- @i) Set @i = @i + 1 EndSelect * from @t order by d asc Srinika |
 |
|
|
|
|
|