我的程序如下
BEGIN
DECLARE @CNT int =33,
@mlogin VARCHAR (1) = 'm',
@concusers INT ='33' ;
SELECT
@CNT = COUNT(*)
FROM
USRINF u, usrdpf usr
WHERE
u.userid = usr.userid
AND u.LOGOUT_TIME IS NULL
AND u.USERID = @USERID ;
SELECT
@mlogin = mlogin, @concusers = concusers
FROM
usrdpf upf
WHERE
upf.USERID = @USERID ;
PRINT @mlogin;-----m
PRINT @concusers;-----33
PRINT @CNT ; ----0
IF (@mlogin = 'Y' AND @CNT < @concusers)
第二个select语句没有执行,执行后我可以看到@mlogin
和@concusers
值作为我指定的默认值,分别是'm'和''33'而@cnt是为什么会这样?