Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7983341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:55:56+00:00 2026-06-04T10:55:56+00:00

I have many Transact-SQL (SQL 2005) scripts in a folder meant to run as

  • 0

I have many Transact-SQL (SQL 2005) scripts in a folder meant to run as a whole unique Job.
I would like to run them one after the other as “scheduled sub-jobs” (one click run) in a ordered way based on the file name (file system folder with many *.sql files) e.g.:

01_init_vars.sql
05_create_this_thing.sql
10_create_another_thing.sql
15_calculate_this_value_based_on_today_date.sql
20_create_that_thing.sql
25_summarize_finish.sql

Every SQL script acts on a different part of the Database, sometimes they use the same tables, but they act at different “logic levels” in different time stamps (i.e. I need to run first one script, then another script, etc.).
All these scripts share “environment variables” that I would like to set only one time in the first script and use them as “SQL session variables” e.g.:

DECLARE @Username NVARCHAR(100)
SET     @Username = 'Blahblahblah'

I was wondering if there is a Microsoft SQL Server Management Studio Tool to merge and run them all, or (better for me) an example of Stored Procedure to run.

Please note that inside some of these “sub-jobs” there can be a Stored Procedure, then I would like to prehvent issues due to Stored Procedures defined and run inside other Stored Procedures, if there are any.

I am so sorry for this very straightforward question, but after querying Google a lot of times with different key words, after looking at standard transact-SQl statements (MSDN website) I am not able to find a proper answer and I think this should be an “usual way” of running tasks on a SQL Database, probably I am missing something and I can’t find what.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:55:57+00:00Added an answer on June 4, 2026 at 10:55 am

    If you’re sharing variables between the scripts, you probably want to investigate Sql Sever Integration Services (SSIS).

    You can control the flow of data between scripts, set up conditional ‘routing’ for the order in which things run and much more that you probably won’t need for this task.

    If you can’t use SSIS for whatever reason, why not just create a new Job in Sql Server Agent and add each script as a new Step in the job? If you need to save results from one for use in another, perhaps just create a table to hold these values for the duration of the job and have the final script remove them “on the way out” as it were.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many PDF forms, I would need to fill them each in php
I have many dependency properties in my WPF usercontrol and many of them are
I have many lines that start like: text.1 text.2 othertext.21 anothertext.50 dfgtext.161 what I
I have many images to display and do paint on them. I want to
I have many small files containing code fragments, pseudo-code algorithms, classes, templates, SQL-samples, etc.,
I have many images which are created dynamically and I am showing them inside
I have many functions like updateUser($id,$username,$email) updateMusic($id, $music) etc... Is there a generic function
I have many routes like: //routes app.get(page1/:action, function(req, res) { ... } app.get(page2/:action, function(req,
I have many views and the problem appears in all of them. I have
I have many thousands of profile URLs that currently look like this: view_profile.php?id=12345 Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.