I have set of database backups created in the production sql server 2005. I need restore these backups into another sql server 2005 by using t-sql script(stored procedure).
Each database will have different number of logical files in it. The physical location of the target server may be different for these logical files. I know that i should use WITH MOVE 'YourMDFLogicalName' TO 'D:DataYourMDFFile.mdf' clause. Now i want to
know how would i put it in a t-script stored procedure such a way that it automatically identifies all the logical files and create a physical file on the target server.
User will supply source of bakup file and target folder for mdf,ldf, etc files.
Do i need to populate the sql query as string by looping through all the logical files? If so how would i execute the populated sql query as string ?
View Complete Post