Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can DTS update columns in a table when importing a text file

Status
Not open for further replies.

nakkii

Programmer
Jul 11, 2002
38
US
I have a DTS package that updates the rows in a table every hour, the import is coming from a comma delimited text file.

What I need to do is if there is a new field added to the text file, I want DTS to automatically add the column to the SQL (2000) table and then update all the rows accordingly.

I think I have the update process figured out, but don't see how to get DTS to add new columns.

Any help or direction would be greatly appreciated.
 
Short answer: DTS can't. Long answer: You can write a procedure, either in SQL Server or outside it, that examines the file and determines if a column has been added. If it has, trigger a stored procedure that ALTERs your TABLE to add the column.
 
Great! Thanks, saves me some time trying to do something DTS can't.

Any pointers on how to get SQL to check the text file in which the first row contains the fields names and compare it to a table that exists?

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top