-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
Mr doubt
  • 51
  • 1
  • 10
  • 42

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')