• sorry i put question wrong way i need as below. when user chooses a field and condition i need to build string dynamically

    drop table #temp

    create table #temp

    (

    Col1 char(10) --colname

    ,Col2 char(1) -- left

    ,Col3 char(1)--write

    ,Col4 VARCHAR(72) -- uid

    ,Col5 char(2) -- conditional operator

    )

    insert into #temp

    select 'col1', '(',')','pqr','or'

    union all select 'col2', '(',')','xyz','or'

    union all select 'col3', '(',')','cef','or'

    union all select 'col4', '(',')','pqr','or'

    select * from #temp

    O/p should be of where clause

    where (col1 = 'pqr')

    or (col2 = 'xyz')

    or (col2 = 'cef')

    or (col2 = 'pqr')