SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Adding SQL Objects to VS201 errors


Adding SQL Objects to VS201 errors

Author
Message
Vishal Sinha
Vishal Sinha
Mr or Mrs. 500
Mr or Mrs. 500 (570 reputation)Mr or Mrs. 500 (570 reputation)Mr or Mrs. 500 (570 reputation)Mr or Mrs. 500 (570 reputation)Mr or Mrs. 500 (570 reputation)Mr or Mrs. 500 (570 reputation)Mr or Mrs. 500 (570 reputation)Mr or Mrs. 500 (570 reputation)

Group: General Forum Members
Points: 570 Visits: 253
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:


Error 98 SQL03006: View: [dbo].[XXX_vw] has an unresolved reference to object [SYS].[FOREIGN_KEYS]. C:\Projects\..\Schema Objects\Schemas\dbo\Views\XXX_vw.view.sql 8 6 DB_NAME


Error 100 SQL03006: 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.sql 3 20 DB_NAME


Error 105 SQL03006: 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.sql 6 35 DB_NAME


Warning 39 SQL04151: 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.sql 152 8 DB_NAME


Warning 46 SQL04151: Procedure: [dbo].[XXX_SP] has an unresolved reference to object [#TEMP_TABLE]. C:\Projects\..\Schema Objects\Schemas\dbo\Programmability\Stored Procedures\XXX_SP.proc.sql 61 7 DB_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!



doug.poe
doug.poe
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 30
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!
grexgregis
grexgregis
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 45
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search