sql 数据列转行
1 declare @sql nvarchar(max);
2 select @sql = isnull(@sql + '],[' , '') + convert(varchar, FiledId) from resumeDetail group by FiledId order by filedId;
3 set @sql = '[' + @sql + ']';
4 set @sql = 'select resumeId,'+ @sql +' from (select FiledText,ResumeId,FiledId from resumeDetail) r pivot (max(FiledText) for FiledId in (' + @sql + ')) BM order by ResumeID';
5 exec sp_executesql @sql