Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Rtrim error out


Rtrim error out

Author
Message
kshatriya24
kshatriya24
SSC Rookie
SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)SSC Rookie (47 reputation)

Group: General Forum Members
Points: 47 Visits: 236
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search