DBA2010
asked on
SQL DB2005
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
Is there any code I can use in SQL or any SSIS PCKG I can use?
any advice?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I cant creat the script. I have this error.
System.OutOfMemoryExceptio n: Exception of type 'System.OutOfMemoryExcepti on' was thrown. at Microsoft.SqlServer.Manage ment.SqlSc riptPublis h.Generate PublishPag e.worker_D oWork(Obje ct sender, DoWorkEventArgs e) at System.ComponentModel.Back groundWork er.OnDoWor k(DoWorkEv entArgs e) at System.ComponentModel.Back groundWork er.WorkerT hreadStart (Object argument)
System.OutOfMemoryExceptio
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.
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.
ASKER
thanks alot
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
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
http://weblogs.asp.net/steveschofield/archive/2005/12/31/change-schema-name-on-tables-and-stored-procedures-in-sql-server-2005.aspx