Solved

sql server 2008 query

Posted on 2013-12-11
3
504 Views
Last Modified: 2013-12-11
I'm using sql server 2008 and Sql Server Management Studio.

I have some scripts to create some stored procedures.
I already know how to execute one stored procedure at time in Sql Server Management Studio.
I just copy an paste the script into SSMS and then click Execute.

I have like 100 working stored procedures, so doing one at a time this way will take a bit.

If I have 4 stored procedure scriptes called the following:

StoredProcedure1.sql
StoredProcedure2.sql
StoredProcedure3.sql
StoredProcedure4.sql

How do I execute these 4 scripts all at once using Sql Server Management Studio?
0
Comment
Question by:maqskywalker
  • 2
3 Comments
 
LVL 11

Expert Comment

by:Angelp1ay
ID: 39712775
Switch to SSMS SQLCMD mode by clicking Query in the menu bar and selecting SQLCMD Mode.

Then execute this:
:setvar path "C:\WhateverPath\"
:r $(path)StoredProcedure1.sql
:r $(path)StoredProcedure2.sql
:r $(path)StoredProcedure3.sql
:r $(path)StoredProcedure4.sql

Open in new window

0
 
LVL 5

Expert Comment

by:dannygonzalez09
ID: 39712781
You can create another Stored proc and embed all these in that stored proc
0
 
LVL 11

Accepted Solution

by:
Angelp1ay earned 500 total points
ID: 39712792
Enabling SQL CMD mode under the Query menuNote the grey background for SQL CMD commands
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now