• mxy - Thursday, February 8, 2018 4:59 PM

    thanks, i do have a scenario where there will be combination 'or', 'and'. 
    if it is only and clause i can split data easily.

    DECLARE @test NVARCHAR(4000)

    SET @test =
      N'((User = ''active'') And Id in ( 1, 2, 3) or userstate=''CT'')'

    SELECT @test

    Just split on the ANDs... Logically, it wouldn't make sense to split ORs... At least I can't think of a valid use case.