I have been working on some stored procedures which create SQL scripts. I build the statement, then print it, creating a report which holds the script. My problem is that on each printed line, SQL adds a "SQLSTATE".
For example,
exec sp_configure 'show advanced options', '1' [SQLSTATE 01000]
reconfigure [SQLSTATE 01000]
go [SQLSTATE 01000]
I can get rid of this by loading the statements into a temp table, then selecting from the table, rather than printing. But that seems rather inelegant. Is there a way that I can continue to use Print, and get rid of the SQLSTATE?
Oh, also, I tried simply adding '--' comment characters at the end of the line ( go -- [SQLSTATE...] ), but in the example, I get an error. It seems the combination of the reconfigure, go, and comments don't work together.
SBPhelps
For example,
exec sp_configure 'show advanced options', '1' [SQLSTATE 01000]
reconfigure [SQLSTATE 01000]
go [SQLSTATE 01000]
I can get rid of this by loading the statements into a temp table, then selecting from the table, rather than printing. But that seems rather inelegant. Is there a way that I can continue to use Print, and get rid of the SQLSTATE?
Oh, also, I tried simply adding '--' comment characters at the end of the line ( go -- [SQLSTATE...] ), but in the example, I get an error. It seems the combination of the reconfigure, go, and comments don't work together.
SBPhelps