nt given output server2000

  • create procedure data_dd(

    @a varchar,

    @b-2 nvarchar)

    as

    begin

    select slno,goals,kpi,weightage,goals_review_date ,recordstatus

    into #temp

    from LIMS..GOALSDTL_Audit

    where empcode=@a --and accyear=@b

    end

    Exec data_dd '002244','2011-2012'

    it gives only row affected mess not shown output !!!

  • the output of that is only the rows affected message as your not selecting anything out, your selecting into a table.

  • 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


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • You're only selecting INTO a #temp table. To get results back you're going to have to select from that #temp table.



    Everything is awesome!

  • if i need the output means what i ve do

  • 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.

  • PM from OP

    raghuldrag (8/23/2012)


    hi friend

    after 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

  • while em exectue the procedure

    exec data_dd '002244','2011-2012'

    showing null .... not given expected output

  • Then there is no data for that particular empcode.

    Please provide DDL, sample data and expected outcome.

  • 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

  • what do you want the output to be?

  • 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.

  • 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

  • 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' */

  • 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