SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER procedure CrossTable
@strTableName as varchar(
@strCol as varchar(
@strGroup as varchar(
@strNumber as varchar(
@strCompute as varchar(
as
declare @strSql as varchar(
execute (
begin
set nocount on
set @strSql=
open corss_cursor
while(
begin
fetch next from corss_cursor
into @strTempCol
if(@@fetch_status <>
set @strSql=@strSql+
end
set @strsql=@strSql+
print @strSql
execute(@strSql)
if @@error <>
print @@error
close corss_cursor
deallocate corss_cursor return
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
From:http://tw.wingwit.com/Article/program/SQL/201311/16332.html