use DB go if(select * from sysobjects where object_id('prcLogin') is not null) drop proc prcLogin go create proc prcLogin @username char(20), @password char(10) as if not exists(select * from biao where userName = @username) begin print 'Not Found User : '+@username return 1 end if (select UserPass from biao where userName=@username) <> @password begin print 'Password Error' return 1 end print 'Login OK' return 0 go
declare @iselect @i=count(*) from biao where userName ='admin' and userPass='admin' if @i>0 select 1 else select 0
go
if(select * from sysobjects where object_id('prcLogin') is not null)
drop proc prcLogin
go
create proc prcLogin @username char(20), @password char(10)
as
if not exists(select * from biao where userName = @username)
begin
print 'Not Found User : '+@username
return 1
end
if (select UserPass from biao where userName=@username) <> @password
begin
print 'Password Error'
return 1
end
print 'Login OK'
return 0
go
if @i>0
select 1
else
select 0