0

We have a stored procedure which calls a table valued function like this

DECLARE @PID INT
DECLARE @PCost DECIMAL(30,15)

SELECT @ID = PID, @PCost = Cost 
FROM [dbo].[myfunction] (@param1, @param2)

but when we try to generate a .dacpac from SSMS, we get this error

Error SQL71501: Error validating element [dbo].[MySP]: Procedure: [dbo].[MySP] has an unresolved reference to object [dbo].[myfunction].[Cost].

Error SQL71501: Error validating element [dbo].[MySP]: Procedure: [dbo].[MySP] has an unresolved reference to object [dbo].[myfunction].[PID].

My table valued function looks like this

ALTER FUNCTION [dbo].[myfunction] 
    (@param1 INT NULL,
     @param2 INT NULL)
RETURNS @temptable TABLE (PID INT, Cost DECIMAL(15,5))
AS 
BEGIN
    INSERT INTO @temptable
        // some select statements
    RETURN
END

The stored procedure works fine without any issues but the error is only when trying to extract datatier .dacpac from SSMS. Does anybody have any idea what's going on in here ?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Prany
  • 2,078
  • 2
  • 13
  • 31
  • Is there any reason you're using a multi-line table value function? They are far slower than an inline TVF. – Thom A Jan 06 '21 at 15:22
  • not really, this was built couple of years ago and has been working since then but will keep this in mind if we do a refactor on these functions for performance – Prany Jan 06 '21 at 15:24

0 Answers0