Re: violation of primary key constraint

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Darren Green (darren.green_at_reply-to-newsgroup-sqldts.com)
Date: 03/16/04


Date: Tue, 16 Mar 2004 20:54:02 +0000

In message <u26YtE5CEHA.3408@tk2msftngp13.phx.gbl>, Andrew Gale
<AGale10495@aol.com> writes
>nice dude, that did it. but why it caused a problem now and never before is
>a mystery (service pack maybe =P )
>
>now that i know how to do it in EM, how do i set the DB at runtime in both
>connection and datapump in VB?
>this is what i have in VB for the dts package object:
>
>goPackage.Connections("Connection 2").DataSource = server
>goPackage.Connections("Connection 2").catalog = catalog
>
>is that enough?
>
If you edit the package in EM through Disco edit you can remove the DB
qualifier name part from the object name, and it will be fine (until you
use the GUI again to select a table when it will add it back). Save the
Pkg too.

This may be enough though. If not you will need to change that property
at run-time.

goPackage.Tasks("DataPump TaskName").SourceObjectName = "dbo.tablename"

Or

goPackage.Tasks("DataPump TaskName").SourceObjectName =
"newdb.dbo.tablename"

>thanks a lot darren.....
>
>--
>andrew gale
>agale10495@aol.com
>
>
>"Darren Green" <darren.green@reply-to-newsgroup-sqldts.com> wrote in message
>news:sKO$LdVZL1VAFwnl@sqldts.com...
>> In message <esZ8N33CEHA.3280@TK2MSFTNGP09.phx.gbl>, Andrew Gale
>> <AGale10495@aol.com> writes
>> >thanx for your reply.
>> >
>> >ok, an update.
>> >
>> >forget VB - i tried running the package thru enterprise manager on the
>> >table, and i get the error again.
>> >
>> >i have this table ("Sig") in 2 DBs, and it works fine on DB "Emdcs".
>> >But if i run the package on that table in DB "Emdcs3", i get that error.
>> >
>> >i don't understand it - i droppped table Sig from Emdcs3, and used DTS to
>> >copy it from Emdcs to Emdc3 (same server).
>> >It ran fine. Then when i ran the package on Emdcs3, i get the error
>> >again!!!
>> >
>> >it makes no sense. no triggers, no primary keys, no identity, no data!,
>> >permissions are fine - i guess i'll install the service pack tommorrow
>> >morning and see what happens....
>> >
>>
>> Are you really changing the DB? The DB is normally held in both the
>> connection and also in the DataPump
>> SourceObjectName/DestinationObjectName.
>>
>> --
>> Darren Green (SQL Server MVP)
>> DTS - http://www.sqldts.com
>>
>> PASS - the definitive, global community for SQL Server professionals
>> http://www.sqlpass.org
>>
>
>

-- 
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com
PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org