0

I pass value to store procedure. The logic is to split value by comma and using a loop.

@Colomns Id,Firstname,Lastname
@values 1,'foo','bar'

Query should be

Select * from user where Id = 1 and Firstname = 'foo' and Lastname = 'bar'
Nive Thaker
  • 87
  • 1
  • 9

1 Answers1

0

Just use substring_index() or concat():

Select *
from user
where concat_ws(Id, firstname, lastname) = @param;

Then, fix the stored procedure to take three parameters! There is no advantage to putting three values into a string, rather than passing in three separate values.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786