What are the challenges you face when working across database platforms? Take the survey
Options

Syntax question

tstadlertstadler Posts: 16
edited February 9, 2006 6:26AM in SQL Backup Previous Versions
Well, this will sound a little stupid but I don't usualy handle scripting but I will ask anyway.
I am reworking some scripts that do automated restores here, they pass in a variable to a stored proc
A standard restore is
exec master..sqlbackup N'-SQL "RESTORE DATABASE [QAT] FROM DISK = ''\\test\test\test.sqb'' WITH RECOVERY"'
I want to pass in a variable like @FilePath,
exec master..sqlbackup N'-SQL "RESTORE DATABASE [QAT] FROM DISK = ''@FilePath'' WITH RECOVERY"'
Wondered if you can provide me some direction how I can do a variable subsutition instead of the actual path.
Thanks

Comments

Sign In or Register to comment.