Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 sql file

Author  Topic 

GoDaddy
Yak Posting Veteran

64 Posts

Posted - 2009-01-27 : 16:50:58
I have tons of .sql files. Can I create a single .sql file that will run all other sql file?

revdnrdy
Posting Yak Master

220 Posts

Posted - 2009-01-28 : 13:54:34
Yes and there are multiple ways to do this.

You can combine all the files into one file and schedule them to run at a specific time using SQL Agent.

You can also combine them all together under a stored procedure and then simply execute that stored procedure.

or you can simple combine them all together in one sql file using sql management studio and hit F5 (which will execute all the queries).

Of course it may not be desirable to do any of those things depending on how it would load down your server. Generally speaking it is better to have several queries to break the work down rather than one giant query that would consume all your resources. If you are in charge of the database it is up to you to make that call.

There are numerous examples on the web on how to to these tasks. Google is your friend.

r&r
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-31 : 15:42:37
You can use SQLCMD for it.
Go to Top of Page
   

- Advertisement -