>Hi,
>
>I want to write a script to restore a number of databases from a backup folder. So I would like to store the names of .BAK file names into an array and then process them, one at a time. How do you create an array (or an equivalent) in T-SQL? And then How do you set up a FOR loop?
>
>TIA.
There is no array in SQL Server. You can pass table variable (if you're using the SQL 2008 and up) and process it using CURSOR's code row by row.
If it's not broken, fix it until it is.
My Blog