Removing trailing spaces

  • Goodday All

    I need to remove trailing spaces but the below gives the following error and i'm using RTRIM on the Lastname and Prefered_Name, please advise if i did something wrong.

    Msg 4121, Level 16, State 1, Line 2

    Cannot find either column "A" or the user-defined function or aggregate "A.RTRIM", or the name is ambiguous.

    Tx

    SELECT

    A.EMPLID,A.RTRIM(LAST_NAME),B.PREFERED_NAME,A.FIRST_NAME,A.LogonName,A.EmailAddr,A.Company,

    A.DESCR,A.EMPL_STATUS,A.Status_Date,A.Initials,A.MobilePhoneNumber,

    A.Province,A.StreetAddress,A.Title,A.Office_Number,A.DepartmentNumber,

    A.Department,A.AssistantName,A.FacsimileTelephoneNumber,

    A.EmployeeType,A.TelephoneAssistant,A.l,A.subarea

    FROM XXXX A INNER JOIN

    SERVERNAME.DB.dbo.TABLE B

    ON (A.EMPLID) = (0 + B.EMPID)

    It's better to fail while trying, rather than fail without trying!!!

  • You should write rtrim(A.Last_Name) instead of A.rtrim(Last_Name).

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Thx!!

    It's better to fail while trying, rather than fail without trying!!!

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

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