Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie question on schema name
Message
From
05/09/2006 12:27:27
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
02/09/2006 16:12:45
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01150537
Message ID:
01150984
Views:
18
>The verbage that Microsoft uses here is unfortunate, but it is standard terminology. In this case, the schema is referring to a SQL Server 2005 security schema, not a database schema. Unless you have a need to use a specific security schema, don't specify the schema_name.
>
>>The template of the store procedure has a term "schema_name". Would this be always the same as the name of the database? Is it a good practice to use a schema_name when creating stored procedures?
>>
>>Thank you.

I have to respectfully disagree here Craig. IMO it is important to include the schema when referencing objects for a couple of reasons. First is that without a specified schema, SQL Server will first look in the user's schema for the object. If it doesn't find it in there then it will look in the dbo schema. This adds a little overhead to the execution which can be cut out by specifying the schema. Second, without the schema you cannot be certain which object is being referenced. If there happens to be an object with the same name in the user's schema but the developer expects to reference the object in dbo, then lots of unpredictable things can happen.

I think that it is better to put "dbo." in front of everything rather than leave it blank.
Previous
Reply
Map
View

Click here to load this message in the networking platform