Re: identitycolumn as pk
From: Ivo Grootjes (IvoGrootjes_at_discussions.microsoft.com)
Date: 12/03/04
- Next message: David Gugick: "Re: Capturing All tables in a SQL server Instance."
- Previous message: Jacco Schalkwijk: "Re: Returning System Date (Without the time)"
- In reply to: Ilya Margolin: "Re: identitycolumn as pk"
- Next in thread: David Gugick: "Re: identitycolumn as pk"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 3 Dec 2004 06:29:08 -0800
GUIDS would solve the problem i guess but i see different problems with
GUIDS. We are using int(4) identity PK's because they're a good datatype for
sqlserver to index. I dont think this is the case with GUIDS or am i totally
wrong on this?
Are there any other solutions to this problem or do i have to generate
primary keys prior to inserting records?
"Ilya Margolin" wrote:
> Ivo,
>
> We had the same problem a while back and resolved it by switching to GUIDs
> in place of identity. It allowed us to copy data between databases/servers
> without breaking sweat.
>
> Ilya
>
> "Ivo Grootjes" <Ivo Grootjes@discussions.microsoft.com> wrote in message
> news:740F7730-0B08-460A-99BC-ACE525C95B88@microsoft.com...
> > Hi NG,
> >
> > This would be my first post on a newsgroup so bare with me :)
> >
> > I'm working on an existing application which uses a database with tables
> > which have identity columns as primarykeys. The webapplication needs new
> > functionality which requires 4 tables to be copied from one database to
> > another. The tables are related to eachother. For instance there's a
> chapter
> > table and a publication table. a chapter can contain 0..* publications.
> The
> > chapter table also has a relation toitself (allowing a hierarchical
> > structure). I'm receiving the data through a asp.net dataset which
> contains 4
> > datatables. What i want to do is insert the data in the new database
> through
> > 4 batch inserts but since i only know the primarykey after i've inserted a
> > record i can't do this.
> >
> > What i'm doing right now to overcome this issue is loop through the
> asp.net
> > datatables and insert the records one by one and store the generated keys
> so
> > i can use them for related records. Because the tables consist of tens of
> > thousands of records this is slow and not the preffered way of doing
> things.
> >
> > What would be a good solution to this. Should i generate a primarykey
> myself
> > outside of the database and change the database schema? I have the feeling
> > that that is the way to go but i'm not really sure. I think using identity
> > columns as primary keys is a commonly used technique so i bet there must
> be
> > other solutions to this problem. Changing the database schema ultimately
> is
> > an option but we prefer not to.
> >
> > Can anybody point out some tips, reading material, or anything else which
> > might help me to find a good solution to this problem?
> >
> > Thank in advance
>
>
>
- Next message: David Gugick: "Re: Capturing All tables in a SQL server Instance."
- Previous message: Jacco Schalkwijk: "Re: Returning System Date (Without the time)"
- In reply to: Ilya Margolin: "Re: identitycolumn as pk"
- Next in thread: David Gugick: "Re: identitycolumn as pk"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|