all groups > sql server dts > january 2006 >
You're in the

sql server dts

group:

DTS (Modify data written to tables based on input from txt file)


DTS (Modify data written to tables based on input from txt file) SteveS
1/26/2006 9:23:04 AM
sql server dts: Given:
I'm using a DTS Package to import data into a table. Each row from a text
file gets placed into a corresponding table.

What I need to do:
I'd like to modify the DTS Package to change the data saved to a table based
on values in the records from the text file. In otherwords,
if a value from the text file > 150 then set a value in the table to 1...
if a value from the text file < 150 then set a value in the table to 2.

Question:
How do I do this?

--
Thank You
Re: DTS (Modify data written to tables based on input from txt file) allan NO[at]SPAM no-spam.sqldts.com
1/29/2006 1:04:56 AM
Hello SteveS,

When you say SET do you mean UPDATE?

If you do then you could use lookups through an ActiveX Transform

http://www.sqldts.com/default.aspx?277

If not and you simply want to check the valkue in the file as it is coming
through and set the value in the destination accordingley then again you
can use an Active Script transform and check the vaue in the column i.e.

IF DTSSource("Column Name") = "Hello" THEN
DTSDestination("Column Name") = "This value"
END IF

Or

you can simply import the file into a staging table AS IS and then use TSQL
to do the manipulation when inserting
INSERT........
SELECT
CASE WHEN ColumnName = "Hello" THEN "This Value" ELSE ColumnName END
as Val,
....


Allan



[quoted text, click to view]


AddThis Social Bookmark Button