Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Schema issues

Author  Topic 

sccrsurfer
Starting Member

43 Posts

Posted - 2013-01-30 : 09:15:11
The tables I've been creating were previously saving as dbo.tablename but now they're saving as UERNAME.tablename. Why? How do I change it back to .dbo? My DTS package is not working properly because it can not form connections to the USERNAME shcema and I dont know how this happened.

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-01-30 : 09:30:04
This is happening because the default schema of the user who is creating the table is not dbo, but is the username. If you change the default schema (in SSMS object explorer, databasename -> Security -> Users), any new table created will use the new schema.

Alternatively, you can explicitly specify the schema name while creating the table. (i.e., dbo.MyTableName instead of just TableName).

You can transfer the tables already created to dbo as well. For example this transfers the table to dbo:
ALTER SCHEMA dbo TRANSFER [USERNAME].[TestTable]
Go to Top of Page

sccrsurfer
Starting Member

43 Posts

Posted - 2013-01-30 : 09:48:22
So I went into my username (as I am the user) and I changed the default schema to dbo. Is that all I need to do?
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-01-30 : 09:49:56
Going forward, that is all you should have to do. Try creating a one test table as that user and test it out to be sure. That, of course, would not have changed the ownership of any tables that have already been created.
Go to Top of Page

sccrsurfer
Starting Member

43 Posts

Posted - 2013-01-30 : 15:18:34
Thank you James. Again :)
Go to Top of Page
   

- Advertisement -