There might be an easier way to perform it, if so, please advise. I am looking for a scriptable solution (preferably TSQL).
I want to code a tsql procedure to restore a database from a backup file (.bak). The procedure must allow to restore a backup from a database to a different database.
When performing it through the SSMS interface, I see all the files in the .bak file. From there, I can associate the files in the backup to the appropriate files in my destination database. when generating TSQL, this translates to MOVE
statements for the files.
Can I translate the whole process in TSQL? In order to know how to map my files, I must first gather the information on which files are present in my bak file. Can one read the definition of the files contained in a backup file before performing
the restore. Preferably using TSQL?
View Complete Post