-1

I am trying to execute a query in c#,the query as

select Id from employee where name in (@name)

i am try to passing 3 cases

1.@name='sa'
2.@name='as,ab'
3.@name='ad'

and the output am expecting

1.id=1

2.id=2

3.id=3

my table employee value contains ,

enter image description here

bob marti
  • 1,523
  • 3
  • 11
  • 27

2 Answers2

0

First create user defined split function in DB using this link Then Apply to your table. it would very easy for you.

-1

How about the assigning the variable

@name='%sa%'

and then using this below query

 select * from employee where Names LIKE (@name)
Sats
  • 1,913
  • 1
  • 15
  • 21