Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I created one stored procedure to get records from table but in giveing an error.
find stored procedure below.

SQL
ALTER procedure getattrecord(
@month int,
@year int
)
as
begin
create table #temp(staffid varchar(10),attstatus char(1))
insert into #temp (select staffid,mrngstatus from demo_tbl where mrngstatus='P' and YEAR(date)=@year and MONTH(date)=@month) union all (select staffid,evngstatus from demo_tbl where evngstatus='P' and YEAR(date)=@year and MONTH(date)=@month)
select staffid,cast(count(*) as float) /2 from #temp group by staffid
end
Posted
Updated 29-May-12 1:34am
v3
Comments
Arul R Ece 29-May-12 7:25am    
Can u Please tell the error message
RDBurmon 29-May-12 7:33am    
Hello OP ,
Post the exact error here . also tell us Why have you given this title to your question ?
Prasad_Kulkarni 29-May-12 7:40am    
..and your problem is??

1 solution

Temporary table will be declared as below:

SQL
Declare @temp table(
	staffid varchar(10),
	attstatus char(1)
	)


Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900