473,388 Members | 1,215 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

To name dbo or not?

Just wondering if there is any advantage to to specifically stating
dbo.TableName in stored procedures.

Is there any reason why I should write this:

SELECT dbo.Contacts.LastName FROM dbo.Contacts

Instead of just:

SELECT LastName from Contacts
All tables are owned by dbo in this database.

Thanks,
lq

Jul 23 '05 #1
2 1469
Is there any reason why I should write this:

SELECT dbo.Contacts.LastName FROM dbo.Contacts


Well, here's a code maintenence reason, not a performance reason: I worked
in an enviroment where it was decided create Beta versions of all the stored
procedures so that certain users could use whatever version of the software
that was in beta. So, an SQL user named "beta" was created, and beta-owned
versions of all the dbo stored procedures were released. The beta version of
the front end application was configured to call the beta-owned database
objects. There were no beta versions of the tables because this was done in
a production OLTP environment, so the data had to be all captured into the
dbo tables. Within the stored procedures, the table names were not qualified
with the owner prefix. This set-up runs nicely for quite a long time with no
glitches. Then one day I am asked to create beta versions of a couple of
tables that so that we can test some performance enhancements we were
working on. So I do this and after a few seconds I query the beta tables I
just created, and much to my suprise, I find some data in there that was
entered by the beta end-user application. I caught a fish! I was not aware
at the time that if you don't qualify your table name with the owner prefix,
SQL Server first checks for a table owned by the user, in this case "beta".
So, because none of the stored procedures used owner-qualified table names,
my new beta tables started capturing data (*ahem* payments), that were
entered in by the "beta" application users. I had to quickly rename by beta
tables to something unique and insert the fish I caught into the dbo tables
where it belonged. Lesson learned the hard way!
Jul 23 '05 #2
My general rule of thumb...

If you plan on making use of the owner/schema of an object (so that you
load multiple objects with the same name but differing owners), then
explicitly state owner.object, otherwise don't, it is not a feature you
are using.

I cannot imagine using dbo will have significant enough performance
gains to be worthwhile compared to other performance opportunities.

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: stewart.midwinter | last post by:
No doubt I've overlooked something obvious, but here goes: Let's say I assign a value to a var, e.g.: myPlace = 'right here' myTime = 'right now' Now let's say I want to print out the two...
2
by: Ravi | last post by:
My XML looks like: <abc> <def type="apple"> 1 </def> <def type="peach"> 2 </def> <def type="orange"> 3 </def> <def type="banana"> 4 </def> <def type="plum"> 5 </def> </abc>
1
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML:...
21
by: TheKeith | last post by:
I heard that the name attribute is deprecated in html 4.01 strict. Is it recommended that you use the ID attribute for images along with the getElementById method instead of the old way? Thanks.
12
by: CJ | last post by:
Why won't this work? I am passing the name of the form (I have two that use this validation script) but I keep getting an error. Error reads: "document.which_form.name is null or not an object" ...
11
by: Andrew Thompson | last post by:
I have written a few scripts to parse the URL arguments and either list them or allow access to the value of any parameter by name. <http://www.physci.org/test/003url/index.html>...
3
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works...
1
by: ivanet | last post by:
Hello everyone, I am trying to use the following Schema but I get the error "src- resolve: Cannot resolve the name 'ValuesList' to a(n) 'element declaration' component." at line 144. I have...
2
by: pythonnewb | last post by:
I am fairly new to programming but have some very basic Java background. I am just learning python and tried to make a module that would allow me to create a file containing an address book. I was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.