I have a string, lets call it the Hash which is equal to "44F3D19B7176128263BDC"
Now, I have a separate table with a structure like this.
What I want to do is that find every record in this table which contains the "Hasher" value on our original string "44F3D19B7176128263BDC".
To do this, we can
- Loop through every record in the Ads table,
- Get the Hasher value of that record,
- Check whether this Hasher value contains in our original hash string.
In SQL, we can do it very easy.
declare @hash varchar(20) = '44F3D19B7176128263BDC'; select * from [dbo].[Ads] where CHARINDEX([Hasher], @hash) > 0 order by DATALENGTH([Hasher]) desc