cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rguggisberg
Level 13

SQL Text Replacement Question

Suppose I have literal brackets ([&]) in my SQL script. How do I do text replacement?
For example... suppose I have the line
BACKUP DATABASE [MyDatabaseName]
How would I do text replacement using the property YOUR_DATABASE_NAME?

Thanks.
Labels (1)
0 Kudos
(2) Replies
chad_petersen
Level 9

I always make the SQL Script so it has a chance of running outside of the installer still.

So I would take a default database name and use that in the script like

BACKUP DATABASE DCP_PROD

Then in the text replacement just do

DCP_PROD -> [YOUR_DATABASE_NAME]

Actually, I use

DCP_PROD -> [IS_SQLSERVER_DATABASE]

More often so I can capture the name of the catalog/database they typed into the UISequence and substitute that in the text replacement.

Chad
0 Kudos
rguggisberg
Level 13

Thanks Chad. Another way to resolve is to just remove the [] as long as spaces are not allowed in the database name.
0 Kudos