UNPIVOT不会返回NULL,但是我需要它们进行比较查询。我试图避免使用ISNULL以下示例(因为在真正的sql中有超过100个字段:
Select ID,theValue,column_name From (select ID,ISNULL(CAST([TheColumnToCompare] AS VarChar(1000)),'') as TheColumnToCompare from MyView where The_Date = '04/30/2009' ) MA UNPIVOT (theValue FOR column_name IN ([TheColumnToCompare]) ) AS unpvt
任何替代品