10

I'm getting the following warning in my Visual Studio 2013 project:

SQL71502 - Procedure has an unresolved reference to object

Warning SQL71502

Nic
  • 12,220
  • 20
  • 77
  • 105
  • possible duplicate of [unresolved reference to object \[INFORMATION\_SCHEMA\].\[TABLES\]](http://stackoverflow.com/questions/18096029/unresolved-reference-to-object-information-schema-tables) – PiotrWolkowski Aug 28 '15 at 14:16

3 Answers3

23

This can be resolved by adding a database reference to the master database.

  1. Add Database Reference:

Add DB reference

  1. Select the master database and click OK:

Select database

  1. Result:

Result

Nic
  • 12,220
  • 20
  • 77
  • 105
  • This did not work for me on SQL Server 2012 and VS2013 – Scott Simontis Sep 21 '15 at 22:00
  • This doesn't fix SQL71501 or SQL71502 where the query uses `FROM [tablename] alias CROSS APPLY alias.[xmlcolumn].query('/*') AS xResult(columname)` to consume columns of type `xml`, even though the query parses and works. – Emyr Dec 02 '15 at 14:06
  • This did not work for me on remove SQL server 2012 and VS2015 too, I have to change the build to compile on error page property – Tony Dong Sep 21 '16 at 22:21
  • This did not work for me either. (Sql Server 2016 and VS 2017) – user3691460 Aug 09 '18 at 21:18
  • Looks like this doesn't always work for everyone, feel free to update the answer (or post your own) if you find a different way to resolve this. – Nic Feb 15 '19 at 05:49
  • 4
    If the errors for some missing types don't go away when you add a reference to master, check your target platform in the db project itself. I had warnings about `[dbo].[string_split]' that didn't go away when adding master. The issue turned out to be that although we were using newer versions of sql server (and thus the sproc worked), the dbproject was set to Sql2014 which didn't have that function available. – Dan Is Fiddling By Firelight Oct 15 '19 at 21:19
1

You just have to set 71502 in the field Buid/Suppress Transact-SQL warning :

See picture in the link

didaskein
  • 21
  • 3
0

Nicholas' answer put me on the right track, but did not fix the issue for me because I had an existing database reference to "master" which was left over from a legacy development environment and SQL server installation.

Deleting this (broken) reference and then re-adding it following Nicholas' instructions worked for me. Note that the "Suppress errors caused by unresolved references..." box wasn't checked by default in VS2019; I had to check that manually.

Eric Hirst
  • 1,111
  • 15
  • 31