sqlserver 动态行转列

DECLARE @SQL VARCHAR(8000)
SET @SQL = 'select overcode '
SELECT @SQL = @SQL + ' , max(case header when ''' + header + ''' then 1 else 0 end) [' + header + ']'
FROM (SELECT DISTINCT header FROM overtime_detail) AS a
SET @SQL = @SQL + ' from overtime_detail group by overcode'
exec(@SQL)

上一篇:C/C++中判断某一文件或目录是否存在


下一篇:启动MYSQL密码审计插件