![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
how to change the name of default schema from dbo to say test1, |
|
or else create another schema say test2 and assign all the user tables to this schema. how to change the name of default schema from dbo to say test1. I tried doing it using the command ALTER schema testschema1 transfer table1 but i get the following error. Msg 15151, Level 16, State 1, Server PC14\SQLEXPRESS, Line 1 Cannot find the object 'table1', because it does not exist or you do not have permission. |
#3
| |||
| |||
|
|
S N (uandme72 (AT) invalid (DOT) com) writes: how to change the name of default schema from dbo to say test1, You cannot rename the dbo schema. In fact, I don't think you can rename schemas at all. At least I can't find out how to do it. or else create another schema say test2 and assign all the user tables to this schema. how to change the name of default schema from dbo to say test1. I tried doing it using the command ALTER schema testschema1 transfer table1 but i get the following error. Msg 15151, Level 16, State 1, Server PC14\SQLEXPRESS, Line 1 Cannot find the object 'table1', because it does not exist or you do not have permission. Well, you cannot transfer a table that does not exist. I'm a little uncertain what you really want to due, but maybe this script will help you out: CREATE TABLE thistable (a int NOT NULL) go SELECT * FROM dbo.thistable go CREATE SCHEMA newschema go ALTER SCHEMA newschema TRANSFER dbo.thistable go SELECT * FROM newschema.thistable go DROP TABLE newschema.thistable go DROP SCHEMA newschema -- Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx |
#4
| |||
| |||
|
|
Actually I want to transfer all the tables in the schema named dbo to another schema which I create as per my choice. |
|
Subsequently I should be able to log into the SQL server in such a way that the default schema being accessed is the new schema created by me and not the dbo schema alongwith being able to execute all the database operations as required. |
![]() |
| Thread Tools | |
| Display Modes | |
| |