In Microsoft SQL Server Management Studio, every time I write a stored procedure such as ThisIsAStoredProcedure
, it ends up showing in the list of stored procedures as COMPANYDOMAIN\MYUSERNAME.ThisIsAStoredProcedure
.
I'd like it to be dbo.ThisIsAStoredProcedure
instead.
I've tried right clicking and renaming, but this doesn't work.
I have three concerns:
- Why is this happening?
- How can I change the existing stored procedures with my domain\username prefix to
dbo.procedurename
? - How can I change the configuration to name procedures
dbo.procedurename
by default?
Best Answer
If you didn't explicitly set it, then objects created by you will be created under the default schema for your user. In SSMS, look in:
Database -> Security -> Users ->
<you>
-> Properties -> General -> Default schemaALTER SCHEMA dbo TRANSFER [COMPANYDOMAIN\MYUSERNAME].ThisIsAStoredProcedure;
Change the setting you looked at in 1.
Of course, you may not have permission to do 2 or 3, in which case it's a question for the person that does have permission.