dbTalk Databases Forums  

LTrim() column during Transform Data Task

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss LTrim() column during Transform Data Task in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dw
 
Posts: n/a

Default LTrim() column during Transform Data Task - 07-07-2004 , 10:43 AM






Hello all. We have a Transform Data Task (TDT) that pulls in data from one
source and inserts it into a table with the same #/type of columns in SQL
Server 2K. However, one field has extra spaces at start and we'd like to run
LTrim() on it. Our TDT is straightforward mapping of the columns from the
source to the destination. How would we accomplish the LTrim() without doing
a SQL query? Thanks.



Reply With Quote
  #2  
Old   
DHatheway
 
Posts: n/a

Default Re: LTrim() column during Transform Data Task - 07-07-2004 , 11:00 AM






1. Set up your DTS task normally, with default transformation mappings.
2. On the Transformations tab, delete the mapping (it's a "Copy Column"
by default) for the column that needs LTRIMming (click on that line and hit
the "delete" button).
3. If the two columns involved don't remain highlighted, click on each of
them to highlight them, then click the "new" button.
4. This brings up a menu of choices called "Create New Transformation".
You should probably pick "Trim String" and click "OK".
5. This brings up your "Transformation Options" for this transformation.
Click "Properties" and select the type of trimming you want ("trim leading
white space").
6. OK out of there.

You could also do this as an ActivX Script-type transformation but that's a
little messier and there's no need for it here.

"dw" <cougarmana_NOSPAM (AT) uncw (DOT) edu> wrote

Quote:
Hello all. We have a Transform Data Task (TDT) that pulls in data from one
source and inserts it into a table with the same #/type of columns in SQL
Server 2K. However, one field has extra spaces at start and we'd like to
run
LTrim() on it. Our TDT is straightforward mapping of the columns from the
source to the destination. How would we accomplish the LTrim() without
doing
a SQL query? Thanks.

Why don't you want to do the "LTRIM(<colname>) as <colname>" in a source
query?




Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: LTrim() column during Transform Data Task - 07-07-2004 , 11:21 AM



Without doing a SQL Query?

You can accomplish this in a ActiveX transform. The only downside to
this is that it is Row * Row processing whereas being able to do it in
the SQL Query would be much better.


Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


Reply With Quote
  #4  
Old   
dw
 
Posts: n/a

Default Re: LTrim() column during Transform Data Task - 07-07-2004 , 11:48 AM



Thanks, DHatheway and Allan Mitchell. The "Trim String" is so easy to set up
as a new transformation; never realized that was there. Thanks :-)

"DHatheway" <dlhatheway (AT) mmm (DOT) com.nospam> wrote

Quote:
1. Set up your DTS task normally, with default transformation mappings.
2. On the Transformations tab, delete the mapping (it's a "Copy Column"
by default) for the column that needs LTRIMming (click on that line and
hit
the "delete" button).
3. If the two columns involved don't remain highlighted, click on each
of
them to highlight them, then click the "new" button.
4. This brings up a menu of choices called "Create New Transformation".
You should probably pick "Trim String" and click "OK".
5. This brings up your "Transformation Options" for this
transformation.
Click "Properties" and select the type of trimming you want ("trim leading
white space").
6. OK out of there.

You could also do this as an ActivX Script-type transformation but that's
a
little messier and there's no need for it here.

"dw" <cougarmana_NOSPAM (AT) uncw (DOT) edu> wrote in message
news:uGfM4kDZEHA.212 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hello all. We have a Transform Data Task (TDT) that pulls in data from
one
source and inserts it into a table with the same #/type of columns in
SQL
Server 2K. However, one field has extra spaces at start and we'd like to
run
LTrim() on it. Our TDT is straightforward mapping of the columns from
the
source to the destination. How would we accomplish the LTrim() without
doing
a SQL query? Thanks.


Why don't you want to do the "LTRIM(<colname>) as <colname>" in a source
query?





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.