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

  • SEARCH
  • Home
  • 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 1061771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:31:21+00:00 2026-05-16T18:31:21+00:00

In SQL Server Management Studio, I want to execute a number of SQL scripts

  • 0

In SQL Server Management Studio, I want to execute a number of SQL scripts (saved queries) one after the other. This is simply to make it easier to run each. I could take each script and combine them all into one massive script and simply execute the lot, however I want it to all be separate so I can easily and simply run each bit by bit.

For example, something like this:

EXEC ('CreateTable1.sql')
EXEC ('CreateTable2.sql')
EXEC ('CreateSP1.sql')
EXEC ('CreateSP2.sql')
EXEC ('SetupTestData.sql')

And that way I can run each line individually and keep everything separate.

  • 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-05-16T18:31:22+00:00Added an answer on May 16, 2026 at 6:31 pm

    if you like you can run then from the command line using SQLCMD -i, and put the commands in to a batch script. then you can call this from SQL management studio using exec xp_cmdshell. Actually you can be brave and run a FOR command under an xp_cmdshell and do the lot in one line. Or perhaps just run xp_cmdshell on them one by one

    Or you can take the approach redgate approach and read the files into variables and then call exec on them. This last approach is serious overkill if all you want to do is exec a few scripts in my opinion.

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

Sidebar

Ask A Question

Stats

  • Questions 525k
  • Answers 525k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I figured out my issue. It looks like the CoreData/Sqlite… May 16, 2026 at 10:11 pm
  • Editorial Team
    Editorial Team added an answer You're after a code coverage program. Which unit testing framework… May 16, 2026 at 10:11 pm
  • Editorial Team
    Editorial Team added an answer TableRow always enforces those values to be respectively MATCH_PARENT and… May 16, 2026 at 10:11 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Is there a way to connect to a remote sql server using management studio
I have an SQL server 2008 database instance on one machine. Now I want
I want to give a client access to a SQL server instance so they
In MS SQL Server if I want to check the results from a Stored
I am using SQL Server 2008 Enterprise on Windows Server 2008 Enterprise. In SQL
I have very limited access to the SQL Server at my ISP. I have
I recently did an import of database from a sql server 2000 database to
Consider the scenario where a database has a SQL Database Role or Application Role.
I have a very complex Linq to SQL query that returns a result set
I know there have been numerous questions here about inline sql vs stored procedures...

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.