select isnull(sum(case when password='input_password' then 2 else 1 end),0) as OK
from userid='input_userid'
OK=0 用户名不存在
OK=1 密码错误
OK=2 验证成功
select isnull(sum(case when password='input_password' then 2 else 1 end),0) as OK
from userid='input_userid'
OK=0 用户名不存在
OK=1 密码错误
OK=2 验证成功