简体   繁体   中英

SQL Query with Extended Stored Procedure

I have some php code that does different database related things like backups and restores. It works fine if I use the built in backup database or restore database queries. We use a product called Red Gate SQL Backup and it uses Extended Stored Procedures to do the work.

 EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE test_database FROM DISK = 'C:\db_backups\FULL_(local)_test_databse.sqb'"'

This command does work. The problem is I have other queries that run after this and the queries don't wait to run. For instance, they try to run right away and the database isn't restored completely yet so they fail.

Is there a way to do this so they won't run until that query is actually done? This doesn't happen with the typical RESTORE DATABASE as it waits until that is done before moving on to the next command in the script.

It probably depends on how you are invoking this command. I'm not aware of PHP having built-in support for running MSSQL queries but I'd wager that there is probably some sort of option on what you use to call this that will either return execution control back to PHP right away or wait for the previous command to finish.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM