dbTalk Databases Forums  

Simple (I hope) question

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Simple (I hope) question in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Paul in Harrow
 
Posts: n/a

Default Simple (I hope) question - 02-15-2005 , 05:03 AM






Hi there,
Table: tblTestImport
Reference varchar (10) Primary Key
PlannedEnd smalldatetime
CompletionStatus smallint
Outcome smallint
ProvSpecLData1 varchar (15) Primary Key
ProvSpecLData2 varchar (15)

The data comes from a csv file and needs to be run 3 times a day. The PK
combo (on the csv file) can be repeated 5 times.
What I need in the sql table is just the LAST PK combo from the csv file (ie
to update)
What happens when I run the DTS Import wizard is the message:
"Violation of PRIMARY KEY constraint 'PK.....' Cannot isert duplicate key in
object 'tblTestImport'.

How do I get 'round this please

Thanks

Paul
PS I've not really used DTS before.



Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Simple (I hope) question - 02-15-2005 , 09:50 AM






Run your import into a (tempoary) staging table. Then use normal SQL to
select the data you want and insert it into the real table.


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com


"Paul in Harrow" <PaulinHarrow (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi there,
Table: tblTestImport
Reference varchar (10) Primary Key
PlannedEnd smalldatetime
CompletionStatus smallint
Outcome smallint
ProvSpecLData1 varchar (15) Primary Key
ProvSpecLData2 varchar (15)

The data comes from a csv file and needs to be run 3 times a day. The PK
combo (on the csv file) can be repeated 5 times.
What I need in the sql table is just the LAST PK combo from the csv file
(ie
to update)
What happens when I run the DTS Import wizard is the message:
"Violation of PRIMARY KEY constraint 'PK.....' Cannot isert duplicate key
in
object 'tblTestImport'.

How do I get 'round this please

Thanks

Paul
PS I've not really used DTS before.





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.