The data is registered in the database with the number 5056381825. But when I like this number with 905056381825, a blank result is returned. What's the solution?
Asked
Active
Viewed 114 times
-1
-
can you please provide some more information. We need the table definition, and for you to tell us which field has the number pattern you re searching for. Thanks. – arcee123 Feb 09 '21 at 23:58
-
Sorry. Table : prCurrAccCommunication Column : CommAddress Type : nvarchar(100) – Heisenberg Feb 10 '21 at 00:14
-
so that 12 digit number is a CommAddress? – arcee123 Feb 10 '21 at 00:27
-
You have changed the code in your question. I get the impression that this edit invalidates the existing answers. This is not appreciated. Please consider undoing that edit and asking a new question on the actual code. – Yunnosch Feb 10 '21 at 10:10
2 Answers
1
The LIKE
seems to be in the wrong direction. Try:
where '905056381825' LIKE CONCAT('%', number, '%')
It is not clear from your question what the name of the column is in the database.

Gordon Linoff
- 1,242,037
- 58
- 646
- 786
0
I assume that the correct query is:
SELECT *
FROM prCurrAccCommunication
WHERE CommAddress LIKE CONCAT('%', number, '%')

Dale K
- 25,246
- 15
- 42
- 71

arielbvargas
- 59
- 1
- 9