>>I need to "move" a bunch of databases from one computer to another. I have created backup of all databases to an external drive. That is, the external drive now has several .BAK files. Do I need to create the databases on the target computer before I can restore from the .BAK files? Or can I restore and create database from .BAK in one step?
>>
>>TIA
>
>In order to write a script that would restore all databases from a certain folder - without hard-coding each database name - I would need to scan all files with extension *.BAK. How can I create a cursor and scan all files from a folder into the cursor (using T-SQL)?
>Or is there a better way to approach the task?
I frequently have to move DB's, so I wrote some VFP and .NET programs that do that.
Are you committed to TSQL for some special reason?
This is an easy task using VFP with SPT or .NET.
You can write one program to do the backups and the restores.
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.