SQL Server 关于带输出的存储过程

来源:百度知道 编辑:UC知道 时间:2024/07/02 09:57:29
CREATE proc pr_login
@ActName Varchar(12),
@Pwd VarChar(50)
as
select count(*) 'Count' from Account where ActName=@ActName and Pwd=@Pwd
GO

现在我想让它在内部就进行判断,例如当它返回的值为1时,执行以下语句:
update Account set Online=1 where ActName=@ActName
请问该怎么做?

CREATE proc pr_login
@ActName Varchar(12),
@Pwd VarChar(50)
as
select count(*) 'Count' from Account
where ActName=@ActName and Pwd=@Pwd
if count=1
begin
update Account set Online=1 where ActName=@ActName
end
这样?不确定