sql server 2008 query

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?
LVL 1
maqskywalkerAsked:
Who is Participating?
 
Angelp1ayConnect With a Mentor Commented:
Enabling SQL CMD mode under the Query menuNote the grey background for SQL CMD commands
0
 
Angelp1ayCommented:
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
 
dannygonzalez09Commented:
You can create another Stored proc and embed all these in that stored proc
0
All Courses

From novice to tech pro — start learning today.