General
cancel
Showing results for 
Search instead for 
Did you mean: 

select statement to see if trailing white spaces

Ratzie
Super Advisor

select statement to see if trailing white spaces

How do I run a select statement to see if the data is being padded by spaces at the end?

I would then like to do a replace to remove the spaces...
something like:
update table
set customer = replace (customer,' ','')
where customer = ??? (above select...);
commit;
1 REPLY
Laurent Menase
Honored Contributor

Re: select statement to see if trailing white spaces

select field_name from table_name where field_name <> RTrim(field_name);

UPDATE table_name
SET field_name=RTrim(field_name)
WHERE field_name <> RTrim(field_name);