Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Rtrim error out Expand / Collapse
Author
Message
Posted Saturday, April 19, 2014 3:05 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Saturday, April 19, 2014 8:15 PM
Points: 42, Visits: 207
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
Post #1563292
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse