dbTalk Databases Forums  

Re: Trim String as default Transform Data Task?

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


Discuss Re: Trim String as default Transform Data Task? in the microsoft.public.sqlserver.dts forum.



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

Default Re: Trim String as default Transform Data Task? - 07-20-2004 , 10:38 AM






You cannot make the Trim String transformation the default.

Yes you can globally change then transformations but this will involve the
object model OR Disconnected Edit use and I think you want to stay away from
that.


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Adam Hauerwas" <Adam Hauerwas (AT) discussions (DOT) microsoft.com> wrote

Quote:
I am fairly new to DTS, but have created a package that imports from eight
text files on a nightly basis into temp tables. The files are created by
Oracle "sqlplus" command-line execution, have a colsep of "|", and have
leading and trailing whitespace.
Quote:
At any rate, when I click on my text file source, my SQL Connection, and
add a "Transform Data" task, the default is to copy data -- whereas I want
it to trim leading and trailing whitespace. Is there a way to make the trim
be the default, or a way to globally change all of my column transforms?
BTW, I am not using ActiveX script anywhere; I'm trying to stick to the GUI
for reproducibility and ease of use.
Quote:
Failing an easy way to do this, I have a Windows "sed" equivalent (BK
ReplaceM) replacing the whitespace in the text files prior to the data
pumps -- but it seemed kludgy, and I thought I'd ask the group.
Quote:
Many thanks. Platform is SQL2K SP3. Feel free to reply direct to
hauerwas (AT) studentweb (DOT) providence.edu.

Adam Hauerwas



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

Default Re: Trim String as default Transform Data Task? - 07-20-2004 , 12:29 PM






With text files I always import into a staging table first. I then perform
my manipulations from there.

Why can you not just set up the correct type of transformation when you
build the package?

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Adam Hauerwas" <AdamHauerwas (AT) discussions (DOT) microsoft.com> wrote

Quote:
Allan,

Thank you for the quick reply! I have found http://www.sqldts.com very
helpful (and dense!), and appreciate your work greatly.

So, do you think the pre-pump "sed" is the best for reproducibility? Or
alternatively, is there a way that I could programmatically rtrim(ltrim(*))
all fields for a given table?
Quote:
Thanks again,

Adam Hauerwas

"Allan Mitchell" wrote:

You cannot make the Trim String transformation the default.

Yes you can globally change then transformations but this will involve
the
object model OR Disconnected Edit use and I think you want to stay away
from
that.

--
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.




Reply With Quote
  #3  
Old   
Adam Hauerwas
 
Posts: n/a

Default Re: Trim String as default Transform Data Task? - 07-20-2004 , 01:11 PM



Maybe I could, and I'm just missing something. But it seems that to set up the transformations when I build the package I would need to a) delete all the standard Copy transformations and b) set up new transformations on a field-by-field basis for each of the incoming fields. If the fields in the text file were to ever change, I'd have to rebuild all the transformations for the additional field?

Excuse my inexperience, please -- I may be missing something basic here.

"Allan Mitchell" wrote:

Quote:
With text files I always import into a staging table first. I then perform
my manipulations from there.

Why can you not just set up the correct type of transformation when you
build the package?


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

Default Re: Trim String as default Transform Data Task? - 07-20-2004 , 01:21 PM



OK

The trim String and Mid String can only have one Source attribute and
Destination attribute so yes you must

"Remove All" first then redo them. This will only need to be done once
though.

If the fields in the text file were ever to change then you would need to do
something about it anyway as DTS will not auto remap for you.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Adam Hauerwas" <AdamHauerwas (AT) discussions (DOT) microsoft.com> wrote

Quote:
Maybe I could, and I'm just missing something. But it seems that to set
up the transformations when I build the package I would need to a) delete
all the standard Copy transformations and b) set up new transformations on a
field-by-field basis for each of the incoming fields. If the fields in the
text file were to ever change, I'd have to rebuild all the transformations
for the additional field?
Quote:
Excuse my inexperience, please -- I may be missing something basic here.

"Allan Mitchell" wrote:

With text files I always import into a staging table first. I then
perform
my manipulations from there.

Why can you not just set up the correct type of transformation when you
build the package?




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

Default Re: Trim String as default Transform Data Task? - 07-21-2004 , 09:12 AM



"Adam Hauerwas" <AdamHauerwas (AT) discussions (DOT) microsoft.com> wrote

Quote:
Maybe I could, and I'm just missing something. But it seems that to set
up the transformations when I build the package I would need to a) delete
all the standard Copy transformations and b) set up new transformations on a
field-by-field basis for each of the incoming fields. If the fields in the
text file were to ever change, I'd have to rebuild all the transformations
for the additional field?
Quote:
Excuse my inexperience, please -- I may be missing something basic here.

"Allan Mitchell" wrote:

With text files I always import into a staging table first. I then
perform
my manipulations from there.

Why can you not just set up the correct type of transformation when you
build the package?

If it's bothering you that much, maybe you should write your own
pre-formatter in VB or DotNet. You could write a reasonably simple tool
that would strip whitespace and maybe do some simple reformatting,
outputting a "cleaned" text file and simply use an Executable task to run it
as part of your package, then you run your transformation task on the
"cleaned" file. You could use this tool in other packages, too.





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.