Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
287 views
in Technique[技术] by (71.8m points)

sql server - 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 ?

question from:https://stackoverflow.com/questions/65598469/error-sql71501-error-validating-element-on-a-stored-procedure

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...