> > Of course, there are plenty of people who might disagree with me:
> > http://www.sqlservercentral.com/columnists/awarren/worstpracti
> > cesobjectsnotownedbydbo.asp
>
> This is my reference:
> http://www.sqlservercentral.com/columnists/awarren/worstpracti
> cesobjectsnotownedbydbo.asp

Yes, that's the same URL I referenced. However, I disagree with the author.
Here's a little quote from that article:

"Even if you don't think about it, you're using ownership when you right a
select statement that refers to a table, like this:

select * from Categories

When that statement is executed, SQL first tries to execute the statement by
assuming that you own the object. 'You' being defined as how you're
connected. Let's say I'm current connected as user 'wp'. That means what SQL
tries to do is this:

select * from wp.Categories

If that object doesn't exist, it then tries to do this:

select * from dbo.Categories

Having to do that little bit of work to figure out the correct object takes
a bit of time. You could make the argument that you should always qualify
objects with an owner - but that would be a best practice and I'll leave it
to others to write about those for now!

You know and I know that we don't qualify all objects. It takes time, makes
the code bigger, maybe a bit less readable. But the number one reason? When
we wrote the code, everything was owned by dbo, what would we gain by adding
dbo. to every object name?"

So why not just create objects with a specific account, and reference that
account as needed? It's more explicit, and I generally prefer things to be
explicit rather than implicit. It also allows you to do things that you
otherwise couldn't do, such as have different objects for different users.
This kind of approach is pretty common in the Oracle world, and will
probably become more common in the SQL Server world as well with the release
of SQL Server 2005, which implements something similar to Oracle schemas if
I understand correctly.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized 
instruction at our training centers in Washington DC, Atlanta, 
Chicago, Baltimore, Northern Virginia, or on-site at your location. 
Visit http://training.figleaf.com/ for more information!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207097
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to