dbTalk Databases Forums  

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

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


Discuss DTS (Modify data written to tables based on input from txt file) in the microsoft.public.sqlserver.dts forum.



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

Default DTS (Modify data written to tables based on input from txt file) - 01-26-2006 , 11:23 AM






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


Reply With Quote
  #2  
Old   
allan@no-spam.sqldts.com
 
Posts: n/a

Default Re: DTS (Modify data written to tables based on input from txt file) - 01-29-2006 , 03:04 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



Quote:
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?




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.