You got to have SP to restore the DB in the master DB. Also put the use master; outside the exec
ALTER DATABASE [mydbPLD] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
use [master]; EXEC ('RESTORE DATABASE mydbPLD
FROM DISK = ' + '''' + @backupFileName + '''' + '
WITH REPLACE,MOVE ''mydbPLD'' TO ''e:\sql\data\MDF\mydbpld.mdf'',
MOVE ''mydbPLD_log'' TO ''E:\SQL\DATA\LDF\mydb_log_pld.ldf'''
);
ALTER DATABASE [mydbPLD] SET MULTI_USER
Satish Kartan www.sqlfood.com
No comments:
Post a Comment