dbTalk Databases Forums  

Concatenate Character in DTS?

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


Discuss Concatenate Character in DTS? in the microsoft.public.sqlserver.dts forum.



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

Default Concatenate Character in DTS? - 09-12-2003 , 09:31 AM






I am working on a project where I need to generate a flat file using sql
data. The machine that I need to load the flat file on is remote relative
to the location of the sql server. I am thinking about using dts (creating
a dts package on the sql server) and running the package remotely from the
client, using osql or something.

The flat file is straight forward except for concatenating "E-" to the
beginning of each field in the first column of data. I think I can probably
use the ActiveX script task to make this transformation but I have no
experience with the ActiveX script task tool. Maybe you know of an easier
way. What are your thoughts?



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

Default Re: Concatenate Character in DTS? - 09-12-2003 , 09:42 AM






Not sure what you want here.

Do you want to generate a text file based on data in SQL Server and for the
First field's data prefix it with E-

If yes then no Acripting is necessary as this, or at least a modified
version of it will work in your Source SQL Statement

SELECT 'E-' + col1,...........
FROM TABLE
WHERE <filter conditions>

If you want to read from a text file and put it into SQL Server doing the
same append then you would use an Active Script transform.

In there you would have, similar to

Function Main

DTSDestination("ColName") = "E-" & DTSSource("ColName")
....
...
..
Main = DTSTransformStat_OK

End Function



--
--

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

"Rick" <bob (AT) bob (DOT) net> wrote

Quote:
I am working on a project where I need to generate a flat file using sql
data. The machine that I need to load the flat file on is remote relative
to the location of the sql server. I am thinking about using dts
(creating
a dts package on the sql server) and running the package remotely from the
client, using osql or something.

The flat file is straight forward except for concatenating "E-" to the
beginning of each field in the first column of data. I think I can
probably
use the ActiveX script task to make this transformation but I have no
experience with the ActiveX script task tool. Maybe you know of an easier
way. What are your thoughts?





Reply With Quote
  #3  
Old   
Justin Thyme
 
Posts: n/a

Default Re: Concatenate Character in DTS? - 09-12-2003 , 12:34 PM



Thank you for the quick reply. You were right though I had to CAST it
this way 'E-' + CAST(MID AS varchar(10)) As OrderID.

Now, can I run this sp remotely using osql and create a text file?

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Not sure what you want here.

Do you want to generate a text file based on data in SQL Server and for
the
First field's data prefix it with E-

If yes then no Acripting is necessary as this, or at least a modified
version of it will work in your Source SQL Statement

SELECT 'E-' + col1,...........
FROM TABLE
WHERE <filter conditions

If you want to read from a text file and put it into SQL Server doing the
same append then you would use an Active Script transform.

In there you would have, similar to

Function Main

DTSDestination("ColName") = "E-" & DTSSource("ColName")
...
..
.
Main = DTSTransformStat_OK

End Function



--
--

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

"Rick" <bob (AT) bob (DOT) net> wrote in message
news:3f61d8e9$0$104$8f4e7992 (AT) newsreader (DOT) goldengate.net...
I am working on a project where I need to generate a flat file using sql
data. The machine that I need to load the flat file on is remote
relative
to the location of the sql server. I am thinking about using dts
(creating
a dts package on the sql server) and running the package remotely from
the
client, using osql or something.

The flat file is straight forward except for concatenating "E-" to the
beginning of each field in the first column of data. I think I can
probably
use the ActiveX script task to make this transformation but I have no
experience with the ActiveX script task tool. Maybe you know of an
easier
way. What are your thoughts?







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

Default Re: Concatenate Character in DTS? - 09-12-2003 , 03:19 PM



Have a look at BCP first.


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
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.