SQL Server Database Project is not showing unresolved object reference error

Jacek Bala 21 Reputation points

I have a problem with SQL Server Database Project in Visual Studio Community 2022 (Version 17.3.5). When I create a blank SQL Server Database Project and add a simple procedure like:

CREATE PROCEDURE [dbo].[SimpleProcedure]
declare @b table(id int)
select dbo.UDF_SomeNotExistingFunction() notExistingColumn
--from @b

and try to compile the project I get a warning saying :

Warning SQL71502: Procedure: [dbo].[SimpleProcedure] has an unresolved reference to object [dbo].[UDF_SomeNotExistingFunction].

That is great.
The problem is that as soon as I uncomment line 'from @b' my warning disappears and I can compile the project without being notified about this kind of issue. It will make a runtime error if is deployed to the SQL Server database.
It also happens when @b is a User Defined Table Type.

Another scenario:
I've added a table to the project:

CREATE TABLE [dbo].[TBL_MyTable]

and modified procedure to:

CREATE PROCEDURE [dbo].[SimpleProcedure]
declare @b table(id int)
mt.Id MyTableId,
dbo.UDF_NotExistingFunction(mt.Id) notExistingColumn
from [dbo].[TBL_MyTable] mt
--join @b b on b.id=mt.Id

when 'join @b' line is uncommented, MSBuild stops complaining about missing reference to UDF_NotExistingFunction

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
9,766 questions
Microsoft Build
Microsoft Build
A Microsoft platform for building applications with Visual Studio and .NET on Windows.
400 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 16,906 Reputation points Microsoft Vendor

    Hello @Jacek Bala ,

    Welcome to Microsoft Q&A forum.

    Please try to update Visual Studio 2022 to the latest version and test again. If this issue persists, I suggest you directly report this issue to Visual Studio Product Team on our Developer Community for further investigate and fix.

    Thanks for helping us make Visual Studio better.


    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful