Prany
Prany

Reputation: 2143

Error SQL71501: Error validating element on a stored procedure

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 ?

Upvotes: 0

Views: 416

Answers (0)

Related Questions