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 |
AKP2008
Starting Member
45 Posts |
Posted - 2009-01-05 : 04:24:58
|
hi,I need to generate an incremental column.My table structure is VALIDFROM VALIDTO 2008-01-23 00:00:00.000 2008-02-22 00:00:00.000 2008-02-22 00:00:00.000 2008-03-23 00:00:00.000 2008-03-23 00:00:00.000 2008-04-23 00:00:00.000 2008-06-23 00:00:00.000 2008-08-13 00:00:00.000 2008-08-13 00:00:00.000 2008-08-24 00:00:00.000 2008-08-24 00:00:00.000 2008-09-15 00:00:00.000 2008-10-1 00:00:00.000 2008-12-20 00:00:00.000 I need an incremental column by comparing validfrom and validto of previous row.My output should be like this.VALIDFROM VALIDTO Column12008-01-23 00:00:00.000 2008-02-22 00:00:00.000 12008-02-22 00:00:00.000 2008-03-23 00:00:00.000 12008-03-23 00:00:00.000 2008-04-23 00:00:00.000 12008-06-23 00:00:00.000 2008-08-13 00:00:00.000 22008-08-13 00:00:00.000 2008-08-24 00:00:00.000 22008-08-24 00:00:00.000 2008-09-15 00:00:00.000 22008-10-1 00:00:00.000 2008-12-20 00:00:00.000 3Please help me to get this.Thanks. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|