I have this script and it works in SQL Server 2012, but I need to use it in SQL Server 2008. Does anyone have a suggestion ?
Create table #TempOne (ID int)
Insert into #TempOne
Values (1), (2), (34), (121), (72), (34), (81), (26), (234)
Create table #TempTwo
(
ID int,
Name Varchar(30),
Age int
)
Insert into #TempTwo
Values (18, 'P', 291), (11, 'P', 21), (13, 'P', 11), (21, 'P', 21)
Select
LEAD(ID,3) Over(Order By ID) As ID, Name , Age
From
(Select ID, NULL As Name, NULL As Age
From #TempOne
Union
Select NULL, Name, age
From #TempTwo) a