Groups | Blog | Home
all groups > sql server dts > september 2003 >

sql server dts : Concatenate Character in DTS?


Rick
9/12/2003 9:31:50 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?

Justin Thyme
9/12/2003 12:34:48 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?

[quoted text, click to view]

Allan Mitchell
9/12/2003 3:42:40 PM
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

[quoted text, click to view]

Allan Mitchell
9/12/2003 9:19:34 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
AddThis Social Bookmark Button