| Author |
Message |
jonstahura
Joined: 28 Sep 2012 Posts: 11
|
Posted: Fri Oct 19, 2012 8:14 pm Post subject: Restore with dynamic fields |
|
|
Hi.. I don't know if anyone has done this, but I have quite a few databases I would like to restore automatically. I have a vb.net program passing variables to a stored procedure and would like the sql backup 7 to use those in the restore command... something like below:
EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE [@sitename + ''_APP_'' + @DBSUFFIX]
FROM DISK = @backupfilepath WITH MOVE DATAFILES TO @dbdirectory,
MOVE LOGFILES TO @tlogdirectory, REPLACE " ' |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6345 Location: Red Gate Software
|
Posted: Mon Oct 22, 2012 4:25 pm Post subject: |
|
|
Thanks for your question. It's not something that we support directly, but the .NET Framework does have a SqlClient namespace that you can use to run queries. To do what you want to in your example, I think it's best to use a parameterized query as in this example: http://www.dotnetperls.com/sqlparameter _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
jonstahura
Joined: 28 Sep 2012 Posts: 11
|
Posted: Mon Oct 22, 2012 5:31 pm Post subject: |
|
|
thanks for the link.. i figured it out.
I needed more single quotes... a LOT more.... and then it worked!  |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6345 Location: Red Gate Software
|
Posted: Tue Oct 23, 2012 8:50 am Post subject: |
|
|
Thanks, I'm glad that worked. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group