Rtrim error out

  • I'm trying to remove trailing space for the following two columns using rtrim with patindex it's not working. It error out saying argument doesn't match . RC_DESCRLONG filed is 1000 charchater variable. I'm searching the string time and date after semicolon: .

    The result i get is 28 charchater long with trailing space when i run SSIS package to transfer the data to excel ...for example

    '1:50 PM '

    '4/18/2014 '

    CASE

    WHEN RC_DESCRLONG LIKE '%The incident occurred time%' THEN substring(RC_DESCRLONG,PATINDEX('%The incident occurred time:%',RC_DESCRLONG)+28,8)

    ELSE

    CAST(RC_DESCRLONG AS VARCHAR(1000))

    END as 'Offense Time',

    CASE

    WHEN RC_DESCRLONG LIKE '%The incident occurred date%' THEN substring(RC_DESCRLONG,PATINDEX('%The incident occurred date:%',RC_DESCRLONG)+28,11)

    ELSE

    CAST(RC_DESCRLONG AS VARCHAR(1000))

    END as 'Offense Date',

    Can you please advise. how do i remove trailing space.

    Thank you in advance

Viewing 0 posts

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