Trim varchars

  • Anybody have a suggestion on trimming varchars? I have a table and all the varchars have alot of white space on them I need to get rid of. I tried using DTS and exporting it to another table with trim string transformations on all the varchars but the result table still has all the white space in it. Any suggestions? Thanks.

  • Ah nm I got it. Kind of silly that the default properties of trim string is not to trim anything.

  • I think you can try like:

    Update

    set f1= Rtrim(ltrim(f1))

    Or

    Update

    set f1= Replace(Rtrim(ltrim(f1)),'')

  • update set <fieldname> = replace(<fieldname>,' ','')

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

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