I\'m fairly new to SQL and I was trying to get a full list of products that match a user input of a productID. Something like:
SELECT ProductID, ProductName
You can convert int to string using CONVERT(ProductID, CHAR(16)) AS ProductID
and then use LIKE
. So in your case it would be
SELECT ProductID, ProductName FROM Products
WHERE CONVERT(ProductID, CHAR(16)) LIKE '%15%'
You should remember that the query will make a full table scan without any support from indices. As a result it will be really expensive and time consuming.