Hi, im using the code below in a store procedure. It is meant to print some text if the column in question does not equal 0.
But its giving me an error because i think the quotation marks are conflicting with the quotations from the SET @SQLSTRING='
How would you use PRINT in this situation?
Thanks
Code:SET @SQLSTRING= ' PRINT 'The results are as follows:' IF (SELECT SUM(Col1) FROM Table) <> 0 PRINT 'Col1 false' IF (SELECT SUM(Col2) FROM Table) <> 0 PRINT 'Col2 false' IF (SELECT SUM(Col3) FROM Table) <> 0 PRINT 'Co3 false' ' EXEC SP_EXECUTESQL @SQLSTRING


Reply With Quote
Bookmarks