1

I have something like the following in a VS2010 database project:

SELECT object_id
FROM [$(MyOtherDB)].sys.tables

In other words referencing a global system object via a user database reference. I’ve set up references to master.dbschema from both the containing project and MyOtherDB project and a reference from the containing project to MyOtherDB project, but I’m still getting SQL04151 warnings. There is some more information about it in this thread (where Gert Drapers seems to confirm that it’s a bug): http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/914c8560-f9c3-40b6-9275-5df48baef9b1.

This seems like to bug to me. The object inside the master.dbschema file is marked as GloballyScoped which means it lives inside the global namespace, which should imply that you can reference it using in the following ways:

  1. [master].[sys].[objects]
  2. [userdb].[sys].[objects]
  3. [sys].[objects]

Option 2 clearly does not work while it should.

I couldn’t find any other references to this scenario via Google. I was just wondering if anyone had come across this and knew of any fixes or work-arounds?

4

0 回答 0