I have to create a new table in my SQL Server 2008 and set my date column to auto increment by 1 day from Getdate()
.
The first entry should insert using the current date, the second entry should use tomorrow's date and the third entry the day after tomorrow's date and so on.
And I also want to know if there is any way to do this manually with update command that it put today's date in 1st column and tomorrows in 2nd.
I got my answer in a simple script:
update t2
set DateColumn = DATEADD(day, rn-1, '1970-01-01')
from @t2 t2
join (
select ROW_NUMBER() over (order by id) rn
, id
from @t2
) t2_numbered
on t2_numbered.id = t2.id
select * from @t2