Link to home
Start Free TrialLog in
Avatar of trknssr
trknssr

asked on

trim all field values in a table

I have a table with several fields. I am trying to trim the spacing in the values in each field.

I know that I can trim a value in a field but how to trim the whole field.

Thanks,
TK
ASKER CERTIFIED SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi trknssr,

you can do an update for each column like

update mytable
set myfield1 = LTRIM(RTRIM(myfield1))), myfield2=LTRIM(RTRIM(myfield2))

hope this helps a bit
bruintje
if you have field that are defined as CHAR(x), you should rather define the m into VARCHAR(x)