开发者

How to name arguments to a UDF?

i'm calling a user-defined function (UDF). i want to be able to name the parameters (like you can with stored procedures) for ease of re开发者_开发百科adability (and to reduce errors), e.g.:

SELECT * FROM CalculateSettlementSheet(7, 2)

would become

SELECT * FROM CalculateSettlementSheet(@BankID = 2, @UserID = 7)

When i try it i get the error message:

Msg 137, Level 15, State 2, Line 1
Must declare the variable '@BankID'.

Possible?


Not possible.

The best you can do is pass in variables.

DECLARE @BankID INT
SET @BankID = 2

DECLARE @UserID INT
SET @UserID = 2

SELECT * FROM CalculateSettlementSheet(@BankID, @UserID)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜