sorry you were right. you need tyo pivot only single column. so this is enoughcreate table test (RowID int,FieldName varchar(20),FieldValue varchar(50))insert into testselect 1 ,'Year','2008' union allselect 1 ,'Month','January' union allselect 2 ,'Year','2007' union allselect 2 ,'Month','March' union allselect 3 ,'Year','2007' union allselect 3 ,'Month','April' union allselect 4 ,'Year','2007' union allselect 4 ,'Month','May' union allselect 5 ,'Year','2006' union allselect 5 ,'Month','March' union allselect 5 ,'Week','27'DECLARE @FieldNameList varchar(8000),@sql varchar(max)SELECT @FieldNameList=STUFF((SELECT DISTINCT ',' + FieldName FROM test ORDER BY ','+ FieldName FOR XML PATH('')),1,1,'')SELECT @FieldNameListSET @sql='select *from(select *from test)mpivot(max(FieldValue) FOR FieldName IN (['+REPLACE(@FieldNameList,',','],[')+']))p'EXEC (@Sql)drop table testoutput---------------------------(11 row(s) affected)Month,Week,Year(1 row(s) affected)RowID Month Week Year1 January NULL 20082 March NULL 20073 April NULL 20074 May NULL 20075 March 27 2006(5 row(s) affected)