[Solved] How to find exact matching string from sql table?


In that case just compare with ID no need like clause. Like clause is required where we have to search word with some pattern OR matching word.

Select *  from products where name="ID"

For Updated Question:

Try below query: You have to apply logic for other character you want to eliminate as like below I have applied logic for character E.

DECLARE @myText VARCHAR(50)='ZE_QE11_IDS_IDC-P01'
SELECT @myText where @myText like '%[^E]IDS%'

Output:ZE_QE11_IDS_IDC-P01

DECLARE @myText VARCHAR(50)='ZE_QE11_EIDS_IDC-P01'
SELECT @myText where @myText like '%[^E]IDS%'

Output:

You can also try SELECT @myText where @myText like '%[_]ID%' if want to word like _ID only not _EID

3

solved How to find exact matching string from sql table?