getting info from temp table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Savas Ates

    getting info from temp table

    My Stored
    *************** *************** *************** ************
    CREATE PROCEDURE st_seconddegree
    @fromwhom numeric(18), @towhom numeric(18) AS
    if not exists (select 1 from crosstable where (fromwhom=@from whom and
    towhom=@towhom ) or (fromwhom=@towh om and towhom=@fromwho m))
    Begin
    create table #pele1
    (xuserid numeric(18),xar kid numeric (18)
    )
    insert into #pele1 SELECT
    xuserid = CASE WHEN fromwhom <> @fromwhom then @fromwhom ELSE fromwhom
    END,
    xarkid = CASE WHEN fromwhom = @fromwhom then towhom ELSE fromwhom END
    FROM crosstable
    where fromwhom=@fromw hom or towhom=@fromwho m
    create table #pele2
    (xuserid numeric(18),xar kid numeric (18)
    )
    insert into #pele2
    SELECT
    xuserid = CASE WHEN fromwhom <> @towhom then @towhom ELSE fromwhom END,
    xarkid = CASE WHEN fromwhom = @towhom then towhom ELSE fromwhom END
    FROM crosstable
    where fromwhom=@towho m or towhom=@towhom

    select #pele1.xarkid as xarkid from #pele1 INNER JOIN #pele2 ON
    #pele1.xarkid=# pele2.xarkid;
    drop table #pele1
    drop table #pele2
    End
    GO
    *************** *************** *************** ************
    in asp

    set rs=baglantim.ex ecute ("st_seconddegr ee @fromwhom='10', @towhom='7'")
    response.write rs("xarkid")

    error is
    ADODB.Recordset (0x800A0CC1) Item cannot
    be found in the collection corresponding to the requested name or ordinal

    I TRIED
    exec st_seconddegree @fromwhom='10', @towhom='7' in Sql query analyser
    it returns me xarkid=2
    it works..

    but in asp it doesnt works.. i thimk it is about temp table field name or
    Drop temp table..
    how can it works in asp?







  • Tibor Karaszi

    #2
    Re: getting info from temp table

    You could try adding SET NOCOUNT ON in the beginning of your proc code...

    --
    Tibor Karaszi, SQL Server MVP




    "Savas Ates" <savas@indexint eractive.com> wrote in message
    news:%23cdyt5wl EHA.3816@TK2MSF TNGP14.phx.gbl. ..[color=blue]
    > My Stored
    > *************** *************** *************** ************
    > CREATE PROCEDURE st_seconddegree
    > @fromwhom numeric(18), @towhom numeric(18) AS
    > if not exists (select 1 from crosstable where (fromwhom=@from whom and
    > towhom=@towhom ) or (fromwhom=@towh om and towhom=@fromwho m))
    > Begin
    > create table #pele1
    > (xuserid numeric(18),xar kid numeric (18)
    > )
    > insert into #pele1 SELECT
    > xuserid = CASE WHEN fromwhom <> @fromwhom then @fromwhom ELSE fromwhom
    > END,
    > xarkid = CASE WHEN fromwhom = @fromwhom then towhom ELSE fromwhom END
    > FROM crosstable
    > where fromwhom=@fromw hom or towhom=@fromwho m
    > create table #pele2
    > (xuserid numeric(18),xar kid numeric (18)
    > )
    > insert into #pele2
    > SELECT
    > xuserid = CASE WHEN fromwhom <> @towhom then @towhom ELSE fromwhom END,
    > xarkid = CASE WHEN fromwhom = @towhom then towhom ELSE fromwhom END
    > FROM crosstable
    > where fromwhom=@towho m or towhom=@towhom
    >
    > select #pele1.xarkid as xarkid from #pele1 INNER JOIN #pele2 ON
    > #pele1.xarkid=# pele2.xarkid;
    > drop table #pele1
    > drop table #pele2
    > End
    > GO
    > *************** *************** *************** ************
    > in asp
    >
    > set rs=baglantim.ex ecute ("st_seconddegr ee @fromwhom='10', @towhom='7'")
    > response.write rs("xarkid")
    >
    > error is
    > ADODB.Recordset (0x800A0CC1) Item cannot
    > be found in the collection corresponding to the requested name or ordinal
    >
    > I TRIED
    > exec st_seconddegree @fromwhom='10', @towhom='7' in Sql query analyser
    > it returns me xarkid=2
    > it works..
    >
    > but in asp it doesnt works.. i thimk it is about temp table field name or
    > Drop temp table..
    > how can it works in asp?
    >
    >
    >
    >
    >
    >
    >[/color]


    Comment

    • Savas Ates

      #3
      Re: getting info from temp table

      thanks
      what is the function of this command
      SET NOCOUNT ON


      Comment

      • Tibor Karaszi

        #4
        Re: getting info from temp table

        It makes SQL Server not return the "rows affected" message after each DML operation. ADO treats this
        as a closed recordset...

        --
        Tibor Karaszi, SQL Server MVP




        "Savas Ates" <savas@indexint eractive.com> wrote in message
        news:eh1xCcxlEH A.596@TK2MSFTNG P11.phx.gbl...[color=blue]
        > thanks
        > what is the function of this command
        > SET NOCOUNT ON
        >
        >[/color]


        Comment

        Working...