Brice Ruth <brice@webprojkt.com> writes:
> SELECT length(monographid) FROM tblpemdruglink WHERE drugid='DG-5039';
> I get 5 returned to me, even though the string is only 4 ('2008').
Okay, so you've got some invisible character in there, but not a space
(else the trim() woulda got rid of it). Tab maybe? Might want to go
back and examine your original data file more carefully, with an editor
that will show you control characters and such.
regards, tom lane