Why does the following return the result when the target column in the where clause is char (20)?
declare @pallettag varchar(20) set @pallettag = '168531' --set @pallettag = @pallettag + SPACE(20 - Len(@pallettag)) select s.ROWID, s.SUBLOTCODE + '*', @pallettag + '*' from IMSUBLOT as s where s.SUBLOTCODE = @pallettag
s.SUBLOTCODE is defined as char (20), and I expect to get the result only if I uncomment the third line, where I added the necessary spaces.
source share