HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMajor

How to change the schema of stored procedure without recreating it

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
storedrecreatingwithouttheprocedurehowchangeschema

Problem

I have some Stored procedure with "SalesTraining" schema.
I want to change all SalesTraining schemas to "Sales".
Is there any better way than recreating the stored procedures?
thnx

Solution

You can use ALTER SCHEMA (Transact-SQL) if you are on SQL Server 2005 or later.

ALTER SCHEMA Sales TRANSFER SalesTraining.MainSP;

Code Snippets

ALTER SCHEMA Sales TRANSFER SalesTraining.MainSP;

Context

StackExchange Database Administrators Q#159081, answer score: 41

Revisions (0)

No revisions yet.