Query Analyzer

  • Using Sql Query Analyzer to perform a simple query, I have noticed that sometimes I have to use the fully qualified name dbo.xxxx for the query to work.  Other times, it is not required (just have to use xxxx).  Is there a setting to turn this on and off or am I doing something wrong?

  • Objects created in a database are context sensitive, unless you qualify it with dbo.

    Say a user kevin, who is a member of the fixed database role db_owner but not a member of the fixed server role sysadmin, creates a new table T1 in database DB1. When you look at the object browser in QA, you will see a table called [kevin].[T1].

    Again, if another user mike, who is a member of sysadmin, creates a table T1 in the same database DB1, the table will now be shown as [dbo].[T1]. Note that these two tables are different, even though they have the same name.

  • To follow-up on Paul's explanations:

    If Mike performs "select * from T1", he will access the [dbo].[T1] table.  If he wants to access [kevin].[T1], Mike has to qualify the table name "select * from kevin.T1".

    Kevin has just the opposite.  If Kevin performs "select * from T1", he will get his [kevin].[T1] table.  If he want the [dbo].[T1] table (assumming he has permissions), he will need to qualify the table: "select * from dbo.T1".

    Hope this helps.



    Mark

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply