| How to generate a date sequence? |
|
Execute the following
script in Query Editor to generate a date sequence and store it in a temporary table:
use AdventureWorks go
select TOP 2000 ID=identity(int,1,1),
[Date]=dateadd(day, -366, convert(char(10),getdate(),112))
into #Date
from sys.objects o1
cross join sys.objects o2
update #Date set [Date] = Dateadd(day, ID, [Date])
select * from #Date
|
| SQLUSA - The Best SQL Server
2005 Training in the World |
|