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.
Author |
Topic |
maevr
Posting Yak Master
169 Posts |
Posted - 2011-04-04 : 07:52:59
|
I have three tables with different number of columns and datatypes.I have a csv-file that contains data for all tables where the first column specifies which table the row belongs to.One column(TRTYP) in the cvs-file specifies if the actual row is going to be deleted, updated or inserted.How can I solve this in the best possible way using SSIS and stored procedures via SQL Server 2008. |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-04-04 : 08:12:25
|
If I had to do it, I would do the following:1. Import the file into a staging table in the database using SSIS or bulk insert. The staging table might be a table with a single varchar(max) column, or it could be one with as many varchar columns as there are in the csv file. 2. I would write a stored procedure to implement the logic of processing the rows - pick all the rows in the target tables that need to be deleted and delete them, update the required rows etc. using delete and update commands, or merge command.But that is me - I can only muddle my way around SSIS, I feel more comfortable with a T-SQL stored proc where I can touch and feel the data and the queries and statements (metaphorically speaking, of course!!) |
|
|
|
|
|