Importing data from different databases.
From: Julie (anonymous_at_discussions.microsoft.com)
Date: 06/16/04
- Next message: David Browne: "Re: using DLL's"
- Previous message: brian: "Loop through each DB"
- In reply to: Star: "Importing data from different databases."
- Next in thread: Star: "Re: Importing data from different databases."
- Reply: Star: "Re: Importing data from different databases."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 16 Jun 2004 07:22:12 -0700
Hi Star,
If as you say code is going to br duplicated then you can
either create a new primary key, or put in a 'range' which
your identity columns adhere to.
If you change the primary key then for the best results
use a uniqueidentifier field, this will create a unique
value irrespective of machine i.e it will always be
different from machine to machine.
The second thing is to have an identity range for each
machine. You would do this by ensuring that each machine
either has a different set of identities i.e
Machine a 0 - 999999
Machine b 1000000 - 1999999
ect
or that it increments by a certian value
i.e.
Machine a 1 11 21
Machine b 2 12 22
For further details have a look at create table in bol
J
>-----Original Message-----
>Hi
>
>We have several databases running on different sites (ex.
sites A,B and C).
>At some point, we want to import data
>from sites A and B into site C.
>
>Our tables have this format:
>
>CREATE TABLE [TableEx] (
> [Code] [int] IDENTITY (1, 1) NOT NULL ,
> [Name] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
> CONSTRAINT [PK_TableEx] PRIMARY KEY CLUSTERED
> (
> [Code]
> ) ON [PRIMARY]
>) ON [PRIMARY]
>
>As you can see, the Code is generated automatically. We
also have other
>tables related with this one, using that Code.
>
>The problem that we have is this. If we try to import
records from site A
>and B into C, it's possible that we could have duplicates
in the Code.
>I mean, we can have a record from Site A with Code 100
and another record
>from Site B with Code 100.
>
>My first idea in order to resolve this, was to generate a
new Code every
>time that we import a record. Unfortunately, later on we
may need
>to update records (synchronize) and we're going to need
the original Code.
>How can we resolve this problem?
>I also thought that maybe I could add two new fields:
OriginalCode and
>SiteID for each table, to keep track of the original
source, but I not sure
>about
>this either. Another person suggested to generate my own
Code, where I can
>use the first 3 bits for the site information, and the
rest for the regular
>Code.
>However, I don't like this solution. Insertion would be
slower, and every
>time that we want to find records from a specific site, I
would have to add
>an extra condition similar to this:
>
>Get records from site 1:
>
>Select * FROM Table1
>Where Code>100000 AND Code<109999
>
>Any ideas?
>
>Thanks a lot!!
>
>
>
>
>
>
>
>
>
>.
>
- Next message: David Browne: "Re: using DLL's"
- Previous message: brian: "Loop through each DB"
- In reply to: Star: "Importing data from different databases."
- Next in thread: Star: "Re: Importing data from different databases."
- Reply: Star: "Re: Importing data from different databases."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|