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.