Solved

Renaming Schema in SQL Server 2008

Posted on 2009-06-30
4
2,556 Views
Last Modified: 2012-08-13
Hi,

I wanted to change the schema of my database objects from "emp" to "employee".

How can I do this using scripts. Also "emp" schema is refrerred in storedprocedure and views. Is there any quick way to change to new schema "employee" in those existing storedprocedure and views.

Thanks in advance.
0
Comment
Question by:r_pat72
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 400 total points
ID: 24750836
There is no facility to rename an existing schema. You have  to create a new schema 'employee' and transfer the ownership.
ALTER SCHEMA emp TRANSFER employee
0
 
LVL 26

Expert Comment

by:Chris Luttrell
ID: 24750852
Red Gate has a refactor tool. I have not tried a schema yet, but you may want to check it out. www.red-gate.com
0
 

Author Comment

by:r_pat72
ID: 24854243
ALTER SCHEMA emp TRANSFER employee is for single object. But if i want to update for all objects at a time is there any procedure or method. Please let me know.

0
 
LVL 26

Assisted Solution

by:Chris Luttrell
Chris Luttrell earned 100 total points
ID: 24856054
there is not a built in one, especially to change references inside existing Stored Procedures and such.
Good luck, best bet is a 3rd party tool that may search the DDL tables for you.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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