How can we help you today? How can we help you today?

Problems with duplicate object name in different schema

--in tempdb, I created the following objects (the refactor tool added the
--brackets, which I would prefer not to see :)
create schema bob
go
create schema bob2
go
create table [bob].[tableName]
(
columnName int
)
go
create table [bob2].[tableName]
(
columnName int
)
go

Then when I hit the qualify objects button:

select *
from [bob].[tableName]

What about bob2? It should at least indicate that another possibility existed using some form of underlining perhaps?
drsql
0

Comments

2 comments

  • Andras B
    drsql wrote:
    --in tempdb, I created the following objects (the refactor tool added the
    --brackets, which I would prefer not to see :)
    create schema bob
    go
    create schema bob2
    go
    create table [bob].[tableName]
    (
    columnName int
    )
    go
    create table [bob2].[tableName]
    (
    columnName int
    )
    go

    Then when I hit the qualify objects button:

    select *
    from [bob].[tableName]

    What about bob2? It should at least indicate that another possibility existed using some form of underlining perhaps?

    This is an interesting case :). In the next beta we will try to resolve the schema based on the default schema of the current user. (much of this is already included in this CTP) If the name is fully qualified, we use the original schema/user. If this is not the case, we look at the parent object owner/schema. Then we look at "dbo", and then we find the first object name that matches in any schema. Apart from the last step, this is the behaviour of SQL Server.

    We assume that the scripts we refactor can be executed. If there are owner/schema resolution problem, SQL Server cannot do anything either.

    But finding such ambiguous cases could be a version 2 feature. Thank you for your feedback,
    Regards,
    Andras
    Andras B
    0
  • drsql
    >>In the next beta we will try to resolve the schema based on the default schema of the current user.<<

    That is a good start, but I think you ought to include underlines to warn us that you made a guess (and why would be nice). If there was only one table named tableName, then no worries. But if you used the one in my schema, but there was another, this is likely what I want, but not necessarily. A warning that that is the case would be really nice.
    drsql
    0

Add comment

Please sign in to leave a comment.