View Full Version : SQL script > text replacement: How do I use variables to replace text in SQL script

05-29-2005, 09:46 PM
I'm using the installScript project to create a database on a client machine.
I need the user to be able to enter the database into a variable to replace the text into the SQL script.

The problem is that I cant seem to get the variables to show in the combo box (SQL script > Text Replacement tab > 'Replace with:' combo field ). I first started to use the MSIinstallscript Project where the properties would show in the combo box. I could then update and use the properties as variables. However the same does not happen for the installscript project. I need to be able to use the installscript because I need a single executable.

I tried creating properities and using e.g [DBNAME] in the combo field, but was trying to repace the '[DBNAME]' and not the properties value.

Could I please have help with this, I know there is some simple I need to do? But I have searched high and low for the answer but just can't seem to find it.

Please Help. :confused:

06-03-2005, 10:55 AM
In the InstallScript project type, you can use the InstallScript's Text Substitutions. Here is an sample InstallScript code to set a value to the Text Substitution named, <MYTEXTSUB>:

TextSubSetValue ( "<MYTEXTSUB>", "First Text Sub", TRUE );
You can use it in the Text Replacement tab as follows:

Find What: foo
Replace With: <MYTEXTSUB>
Hope this helps.

Ron Petty
06-03-2005, 11:11 AM
I just asked the exact same question. I will give this a shot, hope it works!!

06-03-2005, 02:27 PM
I just answered familar question,

I had similar problem,
You can do as follow :
In the text replacment tab define:

Then after you asking user for some data and lets say you place it in szUserData should do the following.
TextSubSetValue ("<USER_DATA>", szUserData , TRUE );

So whats going to happend at a run time it will automaticlly pick up the values that you "register" to be replaces.

You can investigate more about TextSubSetValue functions, its pretty cool,
I dont know if its documented, since I am new with it and have no books so far.


I just asked the exact same question. I will give this a shot, hope it works!!