I have a question. I have a records where ID ends with a special character '-'. I am trying to find all the records athat end with this. So I executed a query as below.
Sel * from Tablename where ID like '%-'
But is not returning any records. But i am sure there are records like that. Can you help me if i am going wrong anywhere.
Thanks in advance.
Solved! Go to Solution.
This column is probably a CHAR(n) and your existing LIKE does find not match any row with a trailing space.
While @David_Roth's works it might return false positives like 'abc- abc' it's better to trim the trailing spaces instead:
where trim(trailing from ID) like '%-'