I have a set of queries(more than 200)(in a notepad file) that i run every week in a sequence one by one. Can someone suggest what can i do to run them with one command. SSIS packages? Sql procedure?
I am a beginner. I am using SQL Server 2005
I have a set of queries(more than 200)(in a notepad file) that i run every week in a sequence one by one. Can someone suggest what can i do to run them with one command. SSIS packages? Sql procedure?
I am a beginner. I am using SQL Server 2005
Have a look at the following: How do you import a large MS SQL .sql file?
For example:
sqlcmd -S <server> -i C:\<your file here>.sql -o
If the queries are the same week in and week out, put them in a stored procedure, and schedule them with a SQL Server Agent job.
CREATE PROCEDURE dbo.WeeklyQueries
AS
BEGIN
SET NOCOUNT ON;
-- 200+ queries go here
END
GO
If you're feeling ambitious, separate them by function and turn them into several stored procedures.
Once you have the procedure(s), create a job with a Transact-SQL step that points to the procedure(s) in the right database(s), and either schedule it to run weekly or just run it on demand every week.