Split sql parameter on comma

前端 未结 4 773
春和景丽
春和景丽 2021-01-14 20:04

Below code works for \'Main Stream\' or \'Premium\' as parameter, however I am trying to make it work for both of them as you can see below, but it doesn\'t return any resul

4条回答
  •  生来不讨喜
    2021-01-14 20:47

    declare @myParameter varchar(50)
    SET @myParameter = 'Main Stream , Premium'
    
    
    select * FROM sales  
    where myCategory IN (select * from string_split(@myParameter,','))
    

提交回复
热议问题