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
 Transact-SQL (2000)
 Export/Import sql2000- Primary Key Problem

Author  Topic 

ezramod
Starting Member

12 Posts

Posted - 2011-12-10 : 07:33:14
Hello, i have a problem, i have 2 database Muonline and MuOnlineOld i want to export data from MuOnlineOld to MuOnline but when i export appear message Cannot export because PRIMARY KEY ID1 is DUBLICATE but MuOnline no have DATA inside is a clear DATABASE, how to export without unchck Primey KEY?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-10 : 08:01:02
may be you've multiple records coming from source table based on PK column. Is column a PK also in source db?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ezramod
Starting Member

12 Posts

Posted - 2011-12-10 : 10:42:06
Yes , on error message appear PK_AccountCharacter Violation Primary key , have any ideea how to resolve this?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-10 : 11:33:22
take distinct based on primary key column and apply some kind of aggregation over other columns. Anyways if you can post some sample data that will help

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ezramod
Starting Member

12 Posts

Posted - 2011-12-10 : 12:18:53
this is table with DATA:
CREATE TABLE [AccountCharacter] (
[Number] [int] IDENTITY (1, 1) NOT NULL ,
[Id] [varchar] (10) COLLATE Latin1_General_CS_AS NOT NULL ,
[GameID1] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameID2] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameID3] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameID4] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameID5] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameIDC] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[MoveCnt] [tinyint] NOT NULL CONSTRAINT [DF__AccountCh__MoveC__7A3223E8] DEFAULT (0),
[Summoner] [tinyint] NOT NULL CONSTRAINT [DF__AccountCh__Summo__4EDDB18F] DEFAULT (1),
CONSTRAINT [PK_AccountCharacter] PRIMARY KEY NONCLUSTERED
(
[Id]
) ON [PRIMARY]
) ON [PRIMARY]
GO


and this is NEW TABLE when i need to import data:
CREATE TABLE [AccountCharacter] (
[Number] [int] IDENTITY (1, 1) NOT NULL ,
[Id] [varchar] (10) COLLATE Latin1_General_CS_AS NOT NULL ,
[GameID1] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameID2] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameID3] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameID4] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameID5] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[GameIDC] [varchar] (10) COLLATE Latin1_General_CS_AS NULL ,
[MoveCnt] [tinyint] NOT NULL CONSTRAINT [DF__AccountCh__MoveC__7A3223E8] DEFAULT (0),
[Summoner] [tinyint] NOT NULL CONSTRAINT [DF__AccountCh__Summo__4EDDB18F] DEFAULT (1),
CONSTRAINT [PK_AccountCharacter] PRIMARY KEY NONCLUSTERED
(
[Id]
) ON [PRIMARY]
) ON [PRIMARY]
GO


but when i execute import or export appear Violation Primary KEY....
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-10 : 12:37:41
this doesnt help much. without seeing data we cant understand why its failing

try this anyways

SELECT id
FROM AccountCharacter
GROUP BY id
HAVING COUNT(*) >1


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ezramod
Starting Member

12 Posts

Posted - 2011-12-12 : 02:18:52
ok today i post some screenshow with database and error
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-12 : 09:14:00
ok...that should help

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -