Feature Request - Assist Dynamic SQL
DavidStein
Posts: 11 Bronze 1
I need to save T-SQL scripts inside a database field to be executed by a SSIS package. This is not an uncommon thing. So, if I need to insert the script into the table and the script has single quotes, it would be nice if SQLPrompt (or a different project) could handle the multiple single quote issues with that.
Basically this:
Becomes this. (I added the Select so one could run it and see the script).
Basically this:
IF EXISTS (SELECT TOP 1 * FROM Lookup.Country WHERE CountryCode = '{{') BEGIN EXEC UnitTest.RaiseValidationErrors 'UPDATEBEFORE' END ELSE IF NOT EXISTS (SELECT TOP 1 * FROM Lookup.Country WHERE CountryCode = '}}' AND CountryName = 'UPD') BEGIN EXEC UnitTest.RaiseValidationErrors 'UPDATEAFTER' END RETURN
Becomes this. (I added the Select so one could run it and see the script).
Select 'IF EXISTS (SELECT TOP 1 * FROM Lookup.Country WHERE CountryCode = ''{{'') BEGIN EXEC UnitTest.RaiseValidationErrors ''UPDATEBEFORE'' END ELSE IF NOT EXISTS (SELECT TOP 1 * FROM Lookup.Country WHERE CountryCode = ''}}'' AND CountryName = ''UPD'') BEGIN EXEC UnitTest.RaiseValidationErrors ''UPDATEAFTER'' END RETURN'
Comments
http://redgate.uservoice.com/forums/94413-sql-prompt-feature-suggestions
These forums are monitored by our developers and allow our users to request features and vote on them.
If a request recieves significant support the feature may be included in a future release.
Product Support
Red Gate Software