Tag Info

New answers tagged

2

Instead of issuing PRINT @tsql;, you can issue EXEC( @tsql );, if I understand what you're asking. If so, I would suggest declaring a preview parameter ( something like DECLARE @Preview BIT = 1; ) and then use an IF to either print or execute. IF ( @Preview = 1 ) BEGIN PRINT @tsql; END ELSE BEGIN EXEC( @tsql ); END;



Top 50 recent answers are included