Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 SSIS text file import

Author  Topic 

montyfintan
Starting Member

4 Posts

Posted - 2008-09-09 : 09:47:10
Hi. I am trying to do what should be a very simple SSIS import of a text file in to a SQL table, but am having problems. I have a simple 2-column CSV text file with columns PART and QTY. The table I need to import the data in to has about 30 columns - two of which are PART and QTY. The PART column in the SQL table is the Primary Key.

My SSIS import fails because the PART column in the csv is attempting to over-write the primary key column in the table: not allowed. I need the PART column in the CSV to tell the SSIS where to update the relevant QTY number, but I don't want to physically update/overwrite that column of data in the table.

Any ideas?


-- I should also add that I'm trying to replace the contents of the QTY column, rather than APPEND new rows to the table. Our stock control system outputs this CSV file with part numbers and stock quantities and I'm trying to get this to update the website stock data via SSIS.

jordanam
Yak Posting Veteran

62 Posts

Posted - 2008-09-09 : 12:51:26
What about importing to a separate table and then running a stored procedure that does whatever you need to do?

You could compare the values, insert/update/delete, etc. You could even produce a quick audit of the changes made through the sproc.

-- You could also set identity insert on during the import. I don't think that covers all your bases though.
Go to Top of Page
   

- Advertisement -