How To Change SQL Server 2008/2005 Object Schema?
Problem
It is not easy to change SQL Server 2008/2005 object schema (tables, stored procedures and views) to "dbo". Here is a solution.
Solution
a. Execute the following SQL script in SQL Server Management Studio query window.
SELECT 'ALTER SCHEMA dbo TRANSFER ' + s.Name + '.' + o.Name
FROM sys.Objects o
INNER JOIN sys.Schemas s on o.schema_id = s.schema_id
WHERE s.Name = 'yourschema'
And (o.Type = 'U' Or o.Type = 'P' Or o.Type = 'V')
b. Copy the output to another query window and execute.
ALTER SCHEMA dbo TRANSFER yourschema.vFindVistType
ALTER SCHEMA dbo TRANSFER yourschema.vEditPatients
ALTER SCHEMA dbo TRANSFER yourschema.T_Referrals
ALTER SCHEMA dbo TRANSFER yourschema.T_Therapist
ALTER SCHEMA dbo TRANSFER yourschema.vOpenRefs
ALTER SCHEMA dbo TRANSFER yourschema.vTherapists
c. Now all objects (tables, stored procedures and views) should be "dbo" schema.
Related Resources
|
Navigator
Other How-Tos
External Windows Resources
External SQL Server Resources
External Webmaster Resources
External Developer Resources
Express SQL Server
CPU: Intel Core 2 Duo E8400
CPU Speed: 3.00GHz
Cache: 6MB
RAM: 4GB RAM
Disk: 2x320GB SATA
RAID: RAID 1
Bandwidth: 1000GB
Win2008 Web or Win2003 STD: Free
IP Addresses: 8
Monthly: $149.00
Detail...
Standard SQL Server
CPU: Quad-Core Xeon E5410
CPU Speed: 2.33GHz
Cache: 12MB
RAM: 4GB RAM
Disk: 2x146GB SCSI
RAID: RAID 1
Bandwidth: 1500GB
Win2008 Web or Win2003 STD: Free
IP Addresses: 8
Monthly: $259.00
Detail...
|