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.
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 MVPhttp://visakhm.blogspot.com/ |
|
|
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? |
|
|
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 MVPhttp://visakhm.blogspot.com/ |
|
|
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]GOand 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]GObut when i execute import or export appear Violation Primary KEY.... |
|
|
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 failingtry this anywaysSELECT idFROM AccountCharacterGROUP BY idHAVING COUNT(*) >1 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
ezramod
Starting Member
12 Posts |
Posted - 2011-12-12 : 02:18:52
|
ok today i post some screenshow with database and error |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-12 : 09:14:00
|
ok...that should help------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|