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
 sql server 2008

Author  Topic 

anjali5
Posting Yak Master

121 Posts

Posted - 2014-04-29 : 16:20:38
Hi All,

Is there any way, I can set up the sql server so that whenever I create a stored procedure/function and tables, they are created under dbo instead of my name. If I forget to prefix a stored procedure with dbo then it automatically assumes my name as prefix.

any help will be appreciated.

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-04-29 : 16:58:16
Under Server Security node in SSMS object explorer, find your login, right click, properties, User mapping tab, and change the Default schema to the dbo.

That will affect only new stored procs that you create. To change existing stored procedures to dbo schema, use the alter schema, for example like this:
ALTER SCHEMA dbo TRANSFER [YourDomain\YourLogin].YourStoredProc;
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2014-04-30 : 01:35:08
If you many objects that you'd like to change in one go , use the sql statement in this post http://www.sqlserver-dba.com/2011/10/alter-schema.html to generate a list of ALTER SCHEMA statements

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -