problem with white space at the end of char column

  • Hi All,

    I converted columns from char to varchar

    when my front end application export those data out,

    those columns still contain white space at the end of the fields,

    even I change the data type, it still contain the space,

    it seem like when the data convert from char to varchar, all those white space already became part of the data.

    so any one have idea, how can I delete those space?

    thx

  • Something like

    update table

    set varcharcolumname = rtrim(varcharcolumname)

    where varcharcolumname like '% '

    would remove the trailing spaces that are already stored, then repeat for each column you converted. I would then rebuild any clustered indexes on affected tables.

    Mike

  • thank you, it works. 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply