I have following store procedure..
I want to return values of variables p,na,sh,fh,na
plz help me what shoulb be done..
ALTER PROCEDURE [dbo].[sp_attendence]
@empid nvarchar(100),
@year int,
@month int
AS
BEGIN
SET NOCOUNT ON;
declare @anoon bit;
declare @bnoon bit;
declare @absent bit;
declare @attendence int;
declare @fh int;
declare @a int;
declare @sh int;
declare @p int;
declare @i int
declare @na int
declare @noofdays int;
set @i=1;
set @fh=0
set @sh=0
set @a=0;
set @p=0;
set @na=0;
SELECT @noofdays=dbo.udf_GetNumDaysInMonth(@month,@year);
while(@i<=@noofdays)
begin
select @anoon =anoon,@bnoon=bnoon,@absent=absent from dbo.sms_hr_EmpAttendence where empid=@empid and year=@year and month=@month and day=@i
if(@anoon ='1' and @bnoon='1')
begin
set @p=@p+1;
end
else if(@bnoon ='1' and @anoon='0')
begin
SET @fh=@fh+1
end
ELSE if(@bnoon='0' and @anoon='1')
begin
set @sh=@sh+1
end
else if(@bnoon='0' and @anoon ='0')
begin
set @a=@a+1
end
else
begin
set @na=@na+1;
end
set @i=@i+1;
end
END