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)
精彩评论