Groups | Blog | Home
all groups > sql server dts > may 2007 >

sql server dts : Trim Blanks in a SSIS Package


Matt
5/14/2007 1:49:01 PM
I'm using SSIS to bring fixed width files into the database. After the
package runs the data has blank spaces at the end of it that need to be
trimmed so "John Doe " would become "John Doe". What is the best way to
trim the blanks when using a SSIS package to do the insert?

Thanks,
Allan Mitchell
5/15/2007 12:00:00 AM
Hello Matt,

I would use a Derived Column transform. something like


REPLACE([Column Name]," ", "")




--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]

Allan Mitchell
5/15/2007 12:00:00 AM
Hello Matt,

LTRIM() and RTRIM() are also string functions in the deived column transformation.
Looking again at the data you hold in the column this is a better fit as
using REPLACE() would cause

"John Doe "

to become

"JohnDoe"



--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]

Matt
5/15/2007 5:37:00 AM
Hi Allan,
I'll give it a try. I didn't know if RTRIM could be used in the package or
not and if so, where I would put it. This is my first SSIS package so it was
a bit different than the few DTS I have done in the past.

Thanks!

[quoted text, click to view]
Matt
5/15/2007 6:17:01 AM
Allan,
I used the wizard to create the SSIS or as much as possible anyway, can you
help to enlighten me on where I can add the RTRIM() command? I don't see
anywhere to put it or an area that shows the derived column. Am I just
overlooking it?

Thanks,
Matt

[quoted text, click to view]
Matt
5/15/2007 6:41:05 AM
Allan,
I think I've got it. I'll give it a try and see how it goes.

Thanks again for all of your help.

Matt

[quoted text, click to view]
AddThis Social Bookmark Button