Forum Discussion

bruni-chue's avatar
bruni-chue
Copper Contributor
Sep 22, 2023

I need to run a large number of individual .sql files quickly

I have a large number of views and indexes that need to be built for our testing environment in a specified order. Up to now, we have just used one long .sql file that had the CREATE statements for the view and indexes. I would like to be able to have separate files for each CREATE statement to make it easier for our developers to use git, but I need to be able to run this build quickly. Is there a way to have a single query or script that can execute the .sql files from a local copy of our git repo. Before I spend time writing something in Powershell to use the sqlcmd utility I wanted to check and see if there was already a tool built into SSMS. Any thoughts or insight on how to do this would be greatly appreciated.

Resources