insert into table variable

  • riya_dave (4/27/2012)


    i am doing it already.still not getting anything

    Well then, nothing more we can do here as you refuse to provide that which we need to really help you. But then you seem resourceful enough to resolve this on your own as you have with the other problems you've posted.

  • riya_dave (4/27/2012)


    but without it i am getting data into seconds ,and with it its running more than 7 minutes ,still not getting data

    what happens when you run just the procedure and not the insert. i would guess it will also run more than 7 min.

    its not the insert that is taking so long.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • it snot inserting into temp7 table,

    y ?

    insert into @temp7

    --

    EXEC pPortfolioDashboard

    @Portfolios = @AdjustPortfolio,

    @FromDate = @FromDate,

    @ToDate = @ToDate,

    )

    i dont find any reason.

  • i am putting it in if condition,does that is the problem?

  • It will insert.

    What's likely happening is that the procedure takes over 7 minutes to complete and only starts retuning data in seconds. since the insert can't complete until the procedure finished (not starts), it it taking a long time.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • ok.is there any other way i can take second sp 's result into first one.

  • riya_dave (4/27/2012)


    ok.is there any other way i can take second sp 's result into first one.

    Yes, but since we can't see what you see not much chance of that happening here.

    Do you really want me to say what we need to help you?

  • Not without running the procedure.

    I suggest you investigate why the procedure is slow. Grant Frichey's book on performance tuning is good (just search for Grant Frichey on Amazon)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • hmm,the second sp also calling 3 sp inside.

    ok. is there any way,u run same sp twice with different parameter ,in 1 sp.

  • Sure

    EXEC StoredProcName @Parameter1

    EXEC StoredProcName @Parameter2

    Just like that.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • ok.its working,but now ,i just want to organize it.

    like i am inserting into @temp so many times with different data,

    so whatever data i insert first should come first.

    i am using group by ,but not working

  • Tables do not provide order, nor is there any guarantee of order. You must provide that order by using an ORDER BY on the select clause pulling the data from the table.

  • Lynn Pettis (4/27/2012)


    Tables do not provide order, nor is there any guarantee of order. You must provide that order by using an ORDER BY on the select clause pulling the data from the table.

    and that is if you have some field to figure out which order they went into the table in. (think identity(1,1))


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • ok,this is my table result

    S&P 3250HOFF

    S&P 3250HOFF

    Julia Hoffman 3250HOFF

    Performance 3267perf

    Performance 3267 perf

    Performance 3267 perf

    Performance 3267 perf

    S&P 500 25 3252 QUEN

    S&P 500 3252 QUEN

    Quentin Collins 3252 QUEN

    i want something like this

    Julia Hoffman 3250HOFF

    S&P 3250HOFF

    S&P 3250HOFF

    Quentin Collins 3252QUEN

    S&P 500 25 3252 QUEN

    S&P 500 3252 QUEN

    Performance 3267perf

    Performance 3267 perf

    Performance 3267 perf

    Performance 3267 perf

    the performance should always be at bottom,no matter what.

    how to do this?

  • ORDER BY CASE WHEN <whatever the column name is> LIKE 'Performance%' then 1 ELSE 0 END

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 16 through 30 (of 32 total)

You must be logged in to reply to this topic. Login to reply