Trimming column values in place (without temporary tables, etc)

  • I have four tables containing the regular chars and varchars. Unfortunately, no one bothered to trim the values of white space before inserting them into the columns. Is there a way to ltrim(rtrim()) in place without resorting to temporary tables or variables?

    I guess I could use a cursor but there has to be a better way.

    Thanks!

    John

  • it is actually pretty straightforward :

    update table set varcharcol = ltrim(rtrim(varcharcol))

    The probability of survival is inversely proportional to the angle of arrival.

  • That makes sense. Too bad I don't have any!

    Thanks a million!

    John

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

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