I want to get the return value of the mssql storage procedure. But just get number of rows affected by the execution.
How to get the return value? Can you help me? Thanks a lot.
Note:
ALTER Procedure [dbo].[S_CreateAccount]
@UserID varchar(12),
@UserPwd varchar(32),
@AdultSign smallint = 2 --0:未成年人 1:成年人 2:没有身份证帐号
AS
BEGIN
SET NOCOUNT ON
return 1 -- I want to get the value
END
SET NOCOUNT OFF
Hi!I have this same problem. My stored functions in Yii return number of rows affected by the execution, but in database is good.
This is my storage function:
CREATE FUNCTION is_login (login_in VARCHAR(20), password_in VARCHAR(255))
RETURNS INT
DETERMINISTIC
BEGIN
DECLARE id_out INT;
DECLARE var VARCHAR(255);
DECLARE salt_var VARCHAR(4);
SET @id_out = 0;
SELECT salt INTO salt_var FROM user WHERE login LIKE login_in;
SELECT SHA1(MD5(CONCAT(password_in,salt_var))) INTO var;
SELECT id INTO @id_out FROM user WHERE login LIKE login_in AND password LIKE var;
RETURN IFNULL(@id_out, 0);
RETURN @id_out;
END
And this is how i call this storage function in yii: