Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I keep getting the error : "Parameters were not supplied" for a very simple table-valued function. I cannot figure out what is the issue. I narrowed the function down to :

create FUNCTION udf_XX_OddFCST()
    RETURNS @output TABLE (
        articlecode nvarchar(50)
    )
AS
BEGIN
    insert into @output(articlecode) values ('abc');
    RETURN
END

So I get the error when executing

select * from udf_XX_OddFCST

Any help would be greatly appreciated.

kind regards


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

1 Answer

you need to use parentheses in your function call :

SELECT * FROM udf_XX_OddFCST()

however as it has been mentioned in the comments, it would be more simpler and more efficient using iTVF:

CREATE FUNCTION udf_XX_OddFCST()
RETURNS TABLE
AS
    RETURN (select 'abc' as articlecode)

SELECT * FROM udf_XX_OddFCST()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...