Adding SQL Objects to VS201 errors

  • I am trying to add database objects of existing SQL database to source control.

    Here are the steps I am using:

    1: create new database project

    2: add dbschemas for master and model databse

    3: add dbschema for tempdb database (from master.dbschema)

    4: Import database objects and settings

    I am able to import all objects but I receive errors when trying to build solutions. All these errors related to INFORMATION_SCHEMA or SYS.XXX objects.

    Database: SQL 2008

    Anyone else faced the same issue(s) and have any suggestions?

    Some errors are:

    Error98SQL03006: View: [dbo].[XXX_vw] has an unresolved reference to object [SYS].[FOREIGN_KEYS].C:\Projects\..\Schema Objects\Schemas\dbo\Views\XXX_vw.view.sql86DB_NAME

    Error100SQL03006: View: [dbo].[XXX_vw] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [SYS].[FOREIGN_KEY_COLUMNS].[FC]::[Column_Name], [SYS].[FOREIGN_KEY_COLUMNS].[Column_Name] or [SYS].[FOREIGN_KEYS].[FC]::[Column_Name].C:\Projects\..\Schema Objects\Schemas\dbo\Views\XXX_vw.view.sql320DB_NAME

    Error105SQL03006: View: [dbo].[XXX_vw] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [SYS].[FOREIGN_KEY_COLUMNS].[FC]::[REFERENCED_COLUMN_ID], [SYS].[FOREIGN_KEY_COLUMNS].[REFERENCED_COLUMN_ID] or [SYS].[FOREIGN_KEYS].[FC]::[REFERENCED_COLUMN_ID].C:\Projects\..\Schema Objects\Schemas\dbo\Views\XXX_vw.view.sql635DB_NAME

    Warning39SQL04151: Procedure: [dbo].[XXX_SP] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [dbo].[TABLE_NAME_1].[SO]::[xtype], [dbo].[TABLE_NAME_2].[SO]::[xtype], [dbo].[sysobjects].[SO]::[xtype] or [dbo].[SYSOBJECTS].[XTYPE].C:\Projects\..\Schema Objects\Schemas\dbo\Programmability\Stored Procedures\XXX_SP.proc.sql1528DB_NAME

    Warning46SQL04151: Procedure: [dbo].[XXX_SP] has an unresolved reference to object [#TEMP_TABLE].C:\Projects\..\Schema Objects\Schemas\dbo\Programmability\Stored Procedures\XXX_SP.proc.sql617DB_NAME

    C:\Projects\..\SCHEMA OBJECTS\SCHEMAS\DBO\PROGRAMMABILITY\FUNCTIONS\UDF_XXX.FUNCTION.SQL(39,8): Warning SQL04151: Function: [dbo].[UDF_XXX] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects: [MASTER].[dbo].[SYSMESSAGES].[SL]::[NAME], [sys].[syslanguages].[NAME] or [sys].[syslanguages].[SL]::[NAME].

    C:\Projects\..\SCHEMA OBJECTS\SCHEMAS\DBO\PROGRAMMABILITY\STORED PROCEDURES\DT_WHOCHECKEDOUT.PROC.SQL(20,84): Warning SQL04151: Procedure: [dbo].[dt_whocheckedout] has an unresolved reference to object [dbo].[dtproperties].[property].

    Thanks in advance!

  • Did you ever resolve this? I have a similar issue with VS2012 giving me warning messages about resolving sys.partitions from within a user defined function (UDF) definition. The actual code works if queried directly, and the UDF defined from the code works just fine, but the warning messages in VS2012 regarding the inability to resolve the reference to a system catalog piece in disconcerting.

    Thanks!

  • I had a similar issue and could solve it by adding master-db as database reference (right click on references -> add database reference -> selecting master in System database).

    Please note:

    1.) as I'm using VS2010 the way of adding a database reference could be different

    2.) I'm still struggling with some sys.-objects; e.g. any usage of sys.syslanguages leads still to a warning "unresolved reference ..."

    any hints on this are welcome 😉

    Hope that helps!

    regards,

    Gregor

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

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