Don't see the reason to combine id, an identifier, and the
[name] field as the primary key. Even both ID and name are CKs, only one
should be selected as the PK, while the AK could be enforced with a unique
index.
In any case with composite primary keys, I would add an id identifier as
the primary key of the table, then create a unique index on the combined
PK. Maybe not good for a modeling homework though.
> Here is a short example that defines two fields as the primary keys of a
table:
>
> CREATE TABLE [dbo].[Table1] (
> [ID] [int] IDENTITY (1, 1) NOT NULL ,
> [Name] [char] (10) NOT NULL
> ) ON [PRIMARY]
> GO
>
> ALTER TABLE [dbo].[Table1] WITH NOCHECK ADD
> CONSTRAINT [PK_Table1] PRIMARY KEY CLUSTERED
> (
> [ID],
> [Name]
> ) ON [PRIMARY]
> GO
>
>
> HtH
>
> Imar
>
> P.S. You could create the table in EM, than script your table to a SQL
file
> to see how the SQL should look.
>
> At 05:34 PM 1/30/2001 +0000, you wrote:
> >I can create 2 primary key in a table with EM, but when I used SQL
> >language it doesn't work. I'll be grateful of any help.
>