Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting a loop in SSMS
Message
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2014
Application:
Web
Miscellaneous
Thread ID:
01608757
Message ID:
01608758
Views:
38
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform