August 23, 2012 at 7:14 am
August 23, 2012 at 7:20 am
the output of that is only the rows affected message as your not selecting anything out, your selecting into a table.
August 23, 2012 at 7:20 am
into #temp
double check your code:
the only thing that does is create a temp table.
then it leaves at the end of the procedure.
maybe you wnat to SELECT from that temp table after it was created? what was it your procedure was supposed to return?
why is the second parameter commented out? testing? on purpose?
Lowell
August 23, 2012 at 7:21 am
You're only selecting INTO a #temp table. To get results back you're going to have to select from that #temp table.
August 23, 2012 at 7:31 am
if i need the output means what i ve do
August 23, 2012 at 7:33 am
remove the into #temp line or select out of the #temp table after doing the insert.
also depends on what else you are doing to the #temp table after the data has been inserted, if nothing, just remove the line.
August 23, 2012 at 7:42 am
PM from OP
raghuldrag (8/23/2012)
hi friendafter removing that temp also its given same message
if you have remove the line detailing into #temp then you have not provided the full stored procedure as you should get results
create procedure data_dd(
@a varchar,
@b-2 nvarchar)
as
begin
select slno,goals,kpi,weightage,goals_review_date ,recordstatus
from LIMS..GOALSDTL_Audit
where empcode=@a --and accyear=@b
end
August 23, 2012 at 7:48 am
while em exectue the procedure
exec data_dd '002244','2011-2012'
showing null .... not given expected output
August 23, 2012 at 7:50 am
Then there is no data for that particular empcode.
Please provide DDL, sample data and expected outcome.
August 23, 2012 at 8:06 am
create table data_dd(slno numeric(22),goals varchar(22),kpi varchar(22),weightage numeric(22),record_status char(8),empcode varchar(12),accyear date)
insert into(1,'webdevelopment',2451,40,u,002244,'2011-2012')
insert into(6,'webdevelopment',2451,46,u,002244,'2011-2012')
insert into(8,'webdevelopment',2451,46,u,001244,'2011-2012')
insert into(9,'webdevelopment',2451,46,u,001244,'2011-2012')
while i am giving empcode and accyear as input in procedure has shown the entire data in field
August 23, 2012 at 8:12 am
what do you want the output to be?
August 23, 2012 at 8:26 am
One other problem, if you don't select from the #temp table inside the stored procedure, you won't see any data anyways as the table will be dropped when the execution of the procedure completes.
August 23, 2012 at 10:00 pm
while i am giving the input of empcode and accyear wanna show entire details.....
/* EXEC data_ddl '001244','2011-2012'
expecting output:
slno goals kpi weightage goals_review_date recordstatus
8 webdevelopment 2451 46 03-03-2011 u
August 24, 2012 at 12:32 am
hi friends,
I am getting the expect output, making the modification on accyear......
alter procedure fst_der
(
@eid varchar(70),
@b-2 datetime,
@C datetime,
--@hist datetime)
as
begin
select slno,goals_type,entrydate,
goals,date_of_commitment,kpi,
weightage,goals_review_date from LIMS..GOALSDTL_Audit
where empcode=@eid
and convert(varchar, accyear,121)
between convert(varchar, @b-2,121)
and convert(varchar, @C,121)
order by slno
end
/* Exec fst_der '002244','20110101','20120101' */
August 24, 2012 at 4:22 am
In that same query i have histroy_date is there , i want to display the data if date contains null and not null....... how to pass the condition on procedure
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply