Re: Generating values as part of a compound key
- From: "Robert Klemme" <bob.news@xxxxxxx>
- Date: Tue, 30 Aug 2005 14:43:54 +0200
Mark wrote:
> BEGINNER QUESTION
>
> I have a table which has a compound primary key consisting of two
> columns.
>
> One of these columns is a foreign key which is generated in another
> table by an identity.
But with "generated" you don't mean it's also inserted into the table with
the compound key at the same time, do you?
> I want to be able to generate the other primary key column value
> automatically when an insert occurs but assume that I cannot use an
> identity because it would have to be unique for this table.
I don't see a problem here because identity *is* unique to your compound
key table.
> There will be potentially more than one user accessing this table so
> I want to avoid generating the key on the client side.
Yes, of course.
> How can I do this? Will it require some hardcore T-SQL?
>
> I hope this is clear (I suspect it isn't) I'd be happy to supply more
> info. I would be extremely grateful for any help!
Not fully to be honest. Maybe you post some DDL so we can see the table
layout. Also, it's not 100% clear to me when inserts in your main table
occur.
Kind regards
robert
.
- Follow-Ups:
- References:
- Generating values as part of a compound key
- From: Mark
- Generating values as part of a compound key
- Prev by Date: Re: Strange date/time anomaly, or am I just stoopid?
- Next by Date: Re: Why the performace differs?
- Previous by thread: Generating values as part of a compound key
- Next by thread: Re: Generating values as part of a compound key
- Index(es):
Relevant Pages
|
|