Hi,
I've a table with two fields representing one Name and the other teh Surname of a persona. I've a to create a Stored Procedure with one input parameter that is a string containing Name and Surname (I don't know in waht order...)
What I'd like to do is to concatenate teh fields Name and Surname and confronting with "LIKE" in the "WHERE" clause... something like this:
Select Name, Surname FROM XXX where (Name + ' ' + Surname LIKE @.parameter OR Surname + ' '+ Name LIKE @.parameter).
The problem is that I don't know neither if it is possible neither the correct syntax...
If there are two similar fields in your database, then you probably just want to check both fields somehing like this:
SELECT Name, Surname FROM XXX WHERE (Name LIKE (@.Name + '%')) AND (Surname LIKE (@.Surname + '%'))
Is this what you're looking for?
No comments:
Post a Comment