RE: best practive TSQL question

RE: best practive TSQL question

 

  

To add...

Visual Studio Database Professional has a bit of a hard time if you
qualify db.owner.object in projects as I've been experiencing some
cross-database dependancy issues (however, _that_ is to be expected for
VSTEDBPro as it is one-db, one-project oriented) with some code. I
don't worry about the cross dependancy, but the fully qualified object
issue is a bit of a surprise in the same database.

Eg:

USE MyDB1

SELECT * FROM MyDB1.dbo.Table1; -- generates an error
in VSTEDBPro and generally b0rks up most of the functionality
(Refactoring being the main).





USE MyDB1

SELECT * FROM master.sys.databases; -- generates an
error, but this is somewhat acceptable as the scope of VSTEDBPro is
one-db per project.





-----Original Message-----
From: Jay Butler
[mailto:mssqldba-ezmlmshield-x15409488.[Email address protected]
Sent: Tuesday, March 20, 2007 10:52 AM
To: LazyDBA Discussion
Subject: RE: best practive TSQL question

I always specify owner and only the database name when necessary. As you
found, portability becomes an issue if you fully qualify object.
Specifying owner saves a catalog lookup because SQL Server will always
opt for objects owned by the current user before using ones owned by
dbo.

Jay

________________________________

From: Ligda John
Sent: Tue 20-Mar-07 13:27
To: LazyDBA Discussion
Subject: best practive TSQL question


What are some pros and cons to citing database.owner. before table names
in stored procedures, udfs, and views?

I used to always do this as a point of precision and style. But if
objects are migrated to another DB there is a lot of extra work.

Any feedback or thoughts?

John


---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



------------------------------------------------------------------------------
NOTICE OF CONFIDENTIALITY
The information contained in this communication and any accompanying document(s) is proprietary and confidential and is intended solely for the above-named individual or entity. If you are not the intended receiver, recipient or entity, you are advised that any distribution, copying, disclosure or communication of this email is strictly prohibited. If you have received this email in error, please contact me at the telephone number listed above or 858.716.1500.
==============================================================================


MS Sql Server LazyDBA home page