How to pass the string parametars in cama saparator

  • hello all,

    i am passing the input parametar string but i want pass int cama saparator like........................

    declare @a varchar(20)

    set @a='NR'

    SELECT NS.nClientID, sSenderID, NS.dtCreatedDate, NU.sClientName, NU.sMobile, NS.sActiveStatus

    FROM NG_SENDERIDS NS, NG_USER_DETAILS NU

    WHERE NS.nClientID = NU.nClientID

    AND sActiveStatus IN(@a)

    here i am not getting the results....

    but actual results is................

    SELECT NS.nClientID, sSenderID, NS.dtCreatedDate, NU.sClientName, NU.sMobile, NS.sActiveStatus

    FROM NG_SENDERIDS NS, NG_USER_DETAILS NU

    WHERE NS.nClientID = NU.nClientID

    AND sActiveStatus IN('N','R')

    but here i am getting the results

    how to slove the problem

  • The where condition not validate two different numbers even the string like @a = 'N,R'

    so try this

    declare @a varchar(20)

    set @a='ABCD'

    select @a

    select substring('ABCD',number,1) from

    /*Your Number table (or)*/

    (select 1 number union select 2 union select 3 union select 4 union select 5 union select 6 ) as Numbers

    where Number <= len(@a)

    /***************/

    SELECT NS.nClientID, sSenderID, NS.dtCreatedDate, NU.sClientName, NU.sMobile, NS.sActiveStatus

    FROM NG_SENDERIDS NS, NG_USER_DETAILS NU

    WHERE NS.nClientID = NU.nClientID

    AND sActiveStatus IN(

    select substring(@a,number,1) from

    /*Your Number table (or)*/

    (select 1 number union select 2 union select 3 union select 4 union select 5 union select 6 ) as Numbers

    where Number <= len(@a))

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

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