SELECT @columns=STUFF((SELECT DISTINCT ', '+QUOTENAME(examid)+' AS '+ QUOTENAME(DayName + CHAR(13) + CONVERT(Nvarchar(10),(exammonth)) +'/' + CONVERT(Nvarchar(10),(examday)) ) FROM examsTB where act =1 GROUP BY DayName,examday,exammonth,examid for XML Path(''),Type).value('.','Nvarchar(MAX)'),1,2,'') ;
RowHeaderColumn="2"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)