My UnPivot Query is as:
Select BirthDate ,FirstName,Gender, Name From Table1
Union
Select BirthDate, FirstName, Gender, Name From
(Select Name2, FirstName2, BirthDate2, Name3, FirstName3, BirthDate3,
Name4, FirstName4, BirthDate4
From Table2)
UnPivot((BirthDate,FirstName,Gender,Name) for sk in ((BIRTHDATE2,FIRSTNAME2,GENDER2,NAME2) as 2,
(BIRTHDATE3,FIRSTNAME3,GENDER3,NAME3) as 3,
(BIRTHDATE4,FIRSTNAME4,GENDER4,NAME4) as 4))
And I know that the error is due to BirthDate where in the first expression it is Datetime2(7), I tried CAST or To_Date but of no help.
Aucun commentaire:
Enregistrer un commentaire