Omer-Pitou
asked on
SQL Server 2008 R2: Execute a Dynamic SQL Statement of more than 10,000 characters
Hi,
I am busy completing a tracking table change stored procedure. The code is running pretty good with small tables (tables with less fields).
I am facing a problem where the dynamic sql statement size is more than 8000 characters.
I even tried to break it into small pieces like EXEC (@stmt1 + @stmt2 + @ stmt3 + @stmt4), but still can't beat it.
Any input is welcome.
Note: The sql involves the use of UNPIVOT and related fields list comes from a variable, and is formated in a way where It allows conversion of all fields to VARCHAR.
I am busy completing a tracking table change stored procedure. The code is running pretty good with small tables (tables with less fields).
I am facing a problem where the dynamic sql statement size is more than 8000 characters.
I even tried to break it into small pieces like EXEC (@stmt1 + @stmt2 + @ stmt3 + @stmt4), but still can't beat it.
Any input is welcome.
Note: The sql involves the use of UNPIVOT and related fields list comes from a variable, and is formated in a way where It allows conversion of all fields to VARCHAR.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was missing something in the previous test.
Thanks for your time