locked
fn_split question RRS feed

  • Question

  • User632751675 posted

    hi,

    I have a stored procedure that uses an optional parameter- it can be null or it can be a comma-delimited string. 

    I first set the parameter to null ( @param varchar(100) = null; ) 

    Then I check the parameter : where isnull(order,'') (select value from fn_split(@param,',')) 

    when I have one value or more, the procedure returns records.  when I don't have anything in that parameter, nothing returns. 

    I have another similar parameter, but it is much simpler and is set with some known values such that if the user does not select it, it returns all records. 

    Should I try to use a different 'where' clause depending on the value of the parameter instead? 

    thanks

    I checked for null values in the where clause - and it seems to be working - sorry I posted too soon. 

    Friday, December 11, 2015 8:39 PM

Answers

  • User1644755831 posted

    Hello MaggieMays,

    >> I checked for null values in the where clause - and it seems to be working - sorry I posted too soon. 

    We are Glad to know you found solution to your problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 17, 2015 1:55 AM