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 Duplicate Records Primary Key

Author  Topic 

PanzerAttack
Yak Posting Veteran

71 Posts

Posted - 2011-06-30 : 11:24:42
Hi, I've been searching but no luck

I have a Flat File I want to import into a table which has a Primary Key.

The Flat file has duplicate Records which I think is causing this to fall over. How do I over come this?

The Table is to be used as a lookup file.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-06-30 : 11:30:07
First import the data to a staging table that doesn't have a primary key.

Then you can import the distinct values from there to your live table.
Go to Top of Page

PanzerAttack
Yak Posting Veteran

71 Posts

Posted - 2011-06-30 : 11:40:27
Thank you.
Go to Top of Page

PanzerAttack
Yak Posting Veteran

71 Posts

Posted - 2011-06-30 : 14:39:09
Is it possible to use an Event Handler of some kind to continue even if the Task Fails?
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-06-30 : 14:48:01
You can use precedence constraints in your SSIS package for this.
Go to Top of Page

ZZartin
Starting Member

30 Posts

Posted - 2011-06-30 : 15:30:21
You should be able increase the error count on the dataflow task so that it keeps running even if some of the records fail to import correctly.
Go to Top of Page

PanzerAttack
Yak Posting Veteran

71 Posts

Posted - 2011-06-30 : 15:55:47
Sorry I only started to use this on Monday, so little things keep tripping me up.

I was able to increase the error count on the Control Flow but can't see it on the Data Flow.

I had a look at precedence constraints on goolge and youtube but it's a little past me. Do you have a link this I might be able to read. Preferably one dealing with duplicate records, so I can see how it applies to me.

thanks again
Go to Top of Page

PanzerAttack
Yak Posting Veteran

71 Posts

Posted - 2011-07-01 : 07:17:52
Sorry again, if I run past you what I'm attempting can you tell me if the approach is right.

My data is being imported with just the Key fields, I want the descriptions to exist in other tables to keep the data files as small and fast as possible.

Therefore, I need to keep these "Lookup" tables updated regularly. To this end I have created an SSIS to import this into an Existing Table but rather than post in the new records as I'd expect it simply fails.

I appreciate the Event Handler and precedence constraints feedback but I can't find an article that's really making it clear to me how these work.
Go to Top of Page

PanzerAttack
Yak Posting Veteran

71 Posts

Posted - 2011-07-06 : 10:06:06
Is there a way rather than creating staging tables (there's a lot) that I could write some sql that calls the SSIS Package and allows me to "Resume Next"?
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-07-06 : 10:56:50
Pretty sure you can tell the transformation task to ignore/continue on error

Have you read this?
Go to Top of Page
   

- Advertisement -