comma delimited string as a variable

  • I know there has to be a way to pass a column delimited string as a variable in a Stored Procedure. Maybe I'm just lazy for posting this in a forum but can somebody help.

    Trouper A. Green


    Trouper A. Green

  • What are you trying to do - pass a delimited string of parameters and then process each as separate parameter or include in a search like

    select smth from tbl

    where col in (@mydelimitedstring)

  • You just pass it in as a varchar.

    create procedure MyPRoc

    @MyParam varchar(100)

    as

    select @MyParam

    return

    go

    declare @C varchar( 100)

    select @C = '1,2,3,4,5'

    exec MyPRoc @C

    Steve Jones

    steve@dkranch.net

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

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