Hi, I am trying to write a sql to get an acct_no from a table say account
I have a table account and acct_no is '123 ' (with spaces) the acct_no table is defined to be of length 8 and whenever i insert a value, it inserts with spaces.
now when i do select * from account where acct_no='123';
i get the row.
but when i do select * from account where acct_no like '123';
i get no row as there are spaces.
i need to do 'like' as acct_no is an optional criteria and i am using a variable that has value sometimes and when no value i do %
As a solution, if i try select * from account where acct_no like '123%' it works.. but the problem is it gets the row where acct_no = 1234 also.