34,590
社区成员
发帖
与我相关
我的任务
分享
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: iamdba tim wang
-- Create date: 2013-6-20
-- Description: 用于统计男女职员人数
-- =============================================
create PROCEDURE usp_employeesCount
@resultCnt_male int output,
@resultCnt_female int output
AS
BEGIN
SET NOCOUNT ON;
select @resultCnt_male =COUNT(*)
from dbo.t
where sex =1 --sex :性别列 1为male 0为femail
select @resultCnt_female =COUNT(*)
from
dbo.t
where sex =0
END
GO
declare @resultf int,@resultm int --变量判断是否
exec usp_employeesCount @resultOut=@resultCnt_male output, @resultm = @resultCnt_female output
select @resultf as femalcount,@resultm as malecount
print @resultOut
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: daiyueqiang
-- Create date: 2013-5-20
-- Description: 判断是否存在用户名和密码是否正确
-- =============================================
create PROCEDURE sp_IsCanLogin
@name varchar(20),
@password varchar(20),
@resultOut int output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
select @resultOut=COUNT(*) --top 1 @resultOut=主键ID
from
dbo.t
where name=@name and name=@password
return @resultOut;
END
GO
declare @resultOut int --变量判断是否
exec sp_IsCanLogin @name='1', @password='22',@resultOut=@resultOut output
print @resultOut