partial match search for integer fields

Asked 2 years ago, Updated 2 years ago, 101 views

I would like to write a SELECT statement that considers an integer field (the range of values is 0 to 99) to be a string and searches for a partial match.
For example, if you specify "7", "17" or "73" will be a hit.
The SQL statements you want here can be run on SQL Server, Oracle, or PostgreSQL.
Is there any way?

sql postgresql sql-server oracle

2022-09-30 21:17

1 Answers

You can perform a partial match search by casting fields.

SELECT* FROM Table WHERE CAST (Integer Field ASTEXT) LIKE '%7%';


2022-09-30 21:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.