concatenate

  • How do i concatenate the two values as one parameter..

    Below is my stored procedure..

    CREATE PROCEDURE dbo.usp_GetTD

    @CTMP VARCHAR(100)

    AS

    SELECT * FROM tableP

    WHERE Ptno IN (@CTMP)

    execute usp_temp '111-11-1111','222-22-2222'

    Thanks for help in advance !!

  • I see what you posted and I'm still not sure what you want. Can you be a bit more descriptive, please?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Assuming there may be more than two of them in there, possibly your best bet is to pass them in as a single string with a unique delimiter:

    execute usp_temp '111-11-1111,222-22-2222,333-33-3333' etc

    Then use a loop to split up the string into individual values, insert these into a temp table, and do a join to this table.

  • Also asked and answered here

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=100812


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 4 posts - 1 through 3 (of 3 total)

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