PDA

View Full Version : Newby Question - restoring a SQL database



Startup
05-21-2004, 02:26 AM
I ve been evaluating IS X for half a day but was so excited already. I was able to create a simple SQL Server database installation integrating all my scripts that I used to invoke via a batch file and osql.exe. However I faced a problem: how can I dynamically (at run time) replace text in my sql scripts with values supplied by the user? For instance, I have a script that calls my stored procedure which restores a database:

DECLARE @DataFolder NVARCHAR(256)
DECLARE @LogFolder NVARCHAR(256)
DECLARE @BackupFolder NVARCHAR(256)
-- Set variables' values
-- ...
EXEC procRestoreMyDatabase @DataFolder. @LogFolder, @BackupFolder

How do I assign run-time values to these variables?

TIA,
Startup

David Thornley
05-21-2004, 10:29 AM
When you click on a script in the IDE there is a Text Replacement tab. You can use this view to instruct the runtime to replace parts of the script with variables defined at runtime.