try this?DECLARE @sample TABLE ( [DueDate] DATE ) INSERT @sampleVALUES ('20120223'),('20120224'),('20120225'),('20120229'); WITH rankedDates AS ( SELECT ROW_NUMBER() OVER ( ORDER BY [DueDate] ) AS [rnk] , [DueDate] FROM @sample )SELECT rd.[DueDate] AS [Original Date] , rd2.[DueDate] AS [Due Date]FROM rankedDates AS rd JOIN rankedDates AS rd2 ON rd2.[rnk] = rd.[rnk] + 1Results:Original Date Due Date------------- ----------2012-02-23 2012-02-242012-02-24 2012-02-252012-02-25 2012-02-29
Note -- I introduced a gap as an extra sampleCharlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION