Solved

Renaming Schema in SQL Server 2008

Posted on 2009-06-30
4
2,579 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 27

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 27

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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, …
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

707 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