-1

I have not able to getting my data using like operation

below is my code

Declare @Search varchar(100)
set @Search='Gender,Name,Age'
select * from Table_SampleData where FieldName LIKE '%' +  @Search + '%'

I have my table data is like below

Table_SampleData

FieldName   Values
Gender       Male
Name         Mazhar
Age          31
Location     Hyderabad

My output should be

FieldName   Values
Gender       Male
Name         Mazhar
Age          31
a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843
mohd mazhar khan
  • 103
  • 1
  • 9
  • 37

1 Answers1

0

Like will try to find a string that contains the string 'Gender,Name,Age' as a whole.

Try using

where FieldName in('Gender','Name','Age')