Click here to Skip to main content
14,639,066 members
Rate this:
Please Sign up or sign in to vote.
See more:
I created one stored procedure to get records from table but in giveing an error.
find stored procedure below.

ALTER procedure getattrecord(
@month int,
@year int
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
Updated 29-May-12 1:34am
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

Temporary table will be declared as below:

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

Hope this helps.

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100