SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 sql file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

GoDaddy
Yak Posting Veteran

64 Posts

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

revdnrdy
Posting Yak Master

USA
220 Posts

Posted - 01/28/2009 :  13:54:34  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
7174 Posts

Posted - 01/31/2009 :  15:42:37  Show Profile  Reply with Quote
You can use SQLCMD for it.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000