none
Unresolved reference to schema [...]? RRS feed

  • Question

  • Dear all,

    I am trying to get to grips with SSDT database projects and one particular problem puzzles me.

    I imported a few databases and tried to get rid of all "Errors".

    Once I managed this, I tried to be more ambitious by switch the project setting "Treat Transact-SQL Warnings as Errors".

    I am now getting several SQL71501 "Table X has unresolved reference to Schema Y"

    Yet, I can see a script for that schema in my project.

    I get the same problems for several schemas.

    How can I get rid of that particular problem?

    THanks

    Eric

    Tuesday, August 5, 2014 2:20 PM

All replies

  • Hi Eric,

    Try this..

    http://www.codeproject.com/Articles/565459/FixingplusSSDTplusunresolvedplusreferenceplustoplu

    Regards,

    Brindha.

    Tuesday, August 5, 2014 2:29 PM
  • Brindha,

    Thanks for this.

    I did have lots of problems of that sort with objects from other databases but I got rid of them as suggested in the article you mention.

    My latest problem puzzles me because there is no other database involved.

    The code is extremely simple

    CREATE TABLE [shared].[Brand] (
        [BrandId]       INT              IDENTITY (50000, 1) NOT NULL,
        [BrandName]     NVARCHAR (50)    NOT NULL,
        [TransactionId] UNIQUEIDENTIFIER NOT NULL,
        [HideName]      BIT              DEFAULT ((0)) NOT NULL,
        [NewRecord]     BIT              DEFAULT ((1)) NOT NULL,
        CONSTRAINT [PK_Brand] PRIMARY KEY CLUSTERED ([BrandId] ASC)
    );


    I do have a script in my project to create that schema, again very simple

    CREATE SCHEMA [shared]
        AUTHORIZATION [dbo];

    The build action for the schema script is set to "Build"...

    Why is it complaining about the schema not existing then?

    Thanks

    Eric


    Tuesday, August 5, 2014 5:18 PM
  • Hi Eric,

    Did you try adding the "master" database reference in your project?

    Regards,

    Brindha.

    Wednesday, August 6, 2014 8:20 AM
  • Hi Eric,

    If the above doesn't solve, I have come across the following link..

    http://social.technet.microsoft.com/Forums/en-US/17b04ac8-095c-47af-9ab9-0660986c0040/issues-with-creating-a-new-vs2012-database-project-with-a-non-default-schemaname?forum=ssdt

    It looks same as your problem. I feel the same. Your project must be missing some reference.

    Regards,

    Brindha.

    Wednesday, August 6, 2014 8:22 AM
  • It's kind of similar but I already have the script for the schema with the Build Action set to "Build", therefore I would not expect t get the error...

    On the other hand, I do have lots of errors in this project , including an error "Error 612 The maximum number of 200 errors has been reached. 359 total errors, 1113 total warnings, and 0 total messages were encountered"

    Could it be that SSDT looses a bit track after too many errors?

    Is this why they show this particular error?

    Wednesday, August 6, 2014 9:02 AM
  • In fact, I just realise I can increase the number of errors displayed and it is 1,472!

    They all seem like nonsense...

    Lots of them complaining about schemas that do have their own script set for "Build".

    I do have base references like master already.

    There must be something drastically wrong somewhere... :-(

    Wednesday, August 6, 2014 9:48 AM
  • Hi Eric,

    Yes, really puzzling. As this has become 2 days old now, do you want to try posting this as a new question again? So that others can notice and try replying.

    Regards,

    Brindha.

    Thursday, August 7, 2014 8:10 AM
  • Hi Eric,

    Perhaps you could share your solution (e.g. zip it up and put it on onedrive, share a link here) so we can download and take a peek?

    JT

    Thursday, August 7, 2014 8:20 AM
  • I kind of solved the problem although I have no idea what happened and why what I did solved it...

    If I looked at my schema creation scripts, I was getting a "compilation" error saying the schema already existed.

    I noticed that I was getting the same problem for all schemas that also existed in a database I was using as a reference so I dropped that reference.

    This cured the problem I had with my schemas.

    I then re-created the database reference but it did not re-introduce the schemas problem...


    Eric Mamet

    Thursday, August 7, 2014 9:03 AM
  • Hi Eric, 

    I encountered the same issue and want to share how I got rid of it.

    In Visual Studio opened the properties of the the new schema script for which error was thrown and changed the Build Action to Build. I rebuilt the project solution and the error was gone.

    Thanks,

    Subhrajit

    Friday, September 6, 2019 6:32 AM