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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Inserting rows violating PK

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-30 : 08:32:06
dan writes "Hi,

I have had to import some really old dodgy data from FoxPro and need to do the following as a one off to get the data in a decent format.

I am trying to run some large insert statements. Do you know if I can configure SQL to skip over inserting any rows that violate the tables primary key but continue inserting rows after that?
Am using SQL 7.0

Thanks
Dan"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-30 : 08:58:30
heap the foxpro data into a stagingtable

insert destinationtable(col_list)
select col_list from stagingtable s
where not exists (select 1 from destinationtable where s.pk = pk)



<O>
Go to Top of Page
   

- Advertisement -