TRIM Function in SQL?

  • With VBScript, I use TRIM to take out the speces in a string value, what should I use with SQL?

    For example,

    SELECT TRIM(City)

    FROM T_City

    WHERE (NOT (City IS NULL))

    WooGor


    WooGor

  • You have the ltrim to trim the left spaces and the rtrim to trim the right spaces. If you want to trim both you can nest them like this:

    select rtrim(ltrim(au_lname)) from authors

  • i have one query.If i want to trim the spAces in between a string then how to do that.eg 'United States' i want to trim as  'UnitedStates' in SQL

  • REPLACE(Country, ' ', '')

    _____________
    Code for TallyGenerator

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

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