snippetsqlMinor
Why are my domain and username being prepended to stored procedures I create?
Viewed 0 times
storedprocedureswhycreateareusernamebeingprependedanddomain
Problem
In Microsoft SQL Server Management Studio, every time I write a stored procedure such as
I'd like it to be
I've tried right clicking and renaming, but this doesn't work.
I have three concerns:
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.procedurenameby default?
Solution
-
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 -> `
-
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.
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 -> `
-> Properties -> General -> Default schema
-
ALTER 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.
Context
StackExchange Database Administrators Q#154919, answer score: 7
Revisions (0)
No revisions yet.