How to use name alternative of acceptedvaluesoption_value when I have text after

  • I work on SQL server 2012 I face issue on code below when

    EStrat value is

    number as sample >1000 or <1000 or =1000 as sample it working good

    because it will use AcceptedValuesOption_Value and this field is integer so no issue on that

    issue happen when EStrat value is <>'Solid State Relay' or ='Solid State Relay'

    so it will use field AcceptedValuesOption_Value and this field is integer so it is wrong and it will stuck

    correct is when EStrat value is <>'Solid State Relay' or ='Solid State Relay' use Name

    so How to correct statement below to do that

    SET @ConStr=  STUFF((SELECT CONCAT(' Or (PM.ZfeatureKey= ', CC.ZfeatureKey , IIF(CC.ZfeatureType='Qualifications',' And AcceptedValuesOption_Value ' ,' And ' +  case when PATINDEX('%[><=]%', EStrat)>0  then 
    'AcceptedValuesOption_Value '
    when EStrat is null then
    'Name '
    else
    'Name '
    end ) , case when PATINDEX('%[><=]%', EStrat)>0 then
    CAST(EStrat AS NVARCHAR(2500))
    when EStrat is null then
    ' is null '
    else
    ''+CAST(EStrat AS NVARCHAR(2500)) +''
    end ,')')

    what i have tried but not working

    SET @ConStr=  STUFF((SELECT CONCAT(' Or (PM.ZfeatureKey= ', CC.ZfeatureKey , IIF(CC.ZfeatureType='Qualifications',' And AcceptedValuesOption_Value ' ,' And ' +  case when PATINDEX('%[><=]%', EStrat)>0 and isnumeric(EStrat)=0 then
  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

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

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