Solved

SQL DB2005

Posted on 2010-11-15
6
831 Views
Last Modified: 2013-11-10
I have about 200 Store Pro. and 300 Views in my Database. I need to change the Database schema from eds.qqqqq to dbo.qqqqqq inside outside and inside these Sp's and Views.

Is there any code I can use in SQL or any SSIS PCKG I can use?

any advice?
Thanks
0
Comment
Question by:DBA2010
6 Comments
 
LVL 10

Expert Comment

by:Humpdy
ID: 34137560
0
 
LVL 3

Accepted Solution

by:
expert_dharam earned 500 total points
ID: 34137659
Follow these steps:
1. Open 'SQL Server Management Studio'
2. Login with Windows Authentication
3. Select and Right Click on the respective database
4. Goto Tasks > Generate Scripts
5. Generate scripts for SPs and Views only
6. Save the script to your desired location and then open it
7. Replace "[eds]." with "[dbo]."
8. Execute the script

(For safe execution, create a dummy database and then execute the script to test.)
0
 

Author Comment

by:DBA2010
ID: 34138367
I cant creat the script. I have this error.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at Microsoft.SqlServer.Management.SqlScriptPublish.GeneratePublishPage.worker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 3

Expert Comment

by:expert_dharam
ID: 34138814
Seems you do not have sufficient RAM to perform this operation.
Make sure you close all the application before you start generating scripts.
Best way to release all the memory resources is by rebooting your system.
0
 

Author Comment

by:DBA2010
ID: 34141970
thanks alot
0
 
LVL 30

Expert Comment

by:Reza Rad
ID: 34142547
No need to generate scripts,
use this sql statement:

DECLARE @sourceschema VARCHAR(100)

DECLARE @destinationschema VARCHAR(100)

SET @sourceschema = 'sourceschema'

SET @destinationschema = 'destinationschema'

SELECT 'ALTER SCHEMA ' + @destinationschema + ' TRANSFER ' + b.name + '.' + a.name FROM sys.objects a JOIN sys.schemas b

ON a.schema_id=b.schema_id WHERE a.type IN ('U','P','FN','V') AND b.name=@sourceschema


referenece:
http://www.sql-articles.com/scripts/change-transfer-schema-for-all-objects
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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 backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

758 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

20 Experts available now in Live!

Get 1:1 Help Now