June 1, 2006 at 10:55 am
How to declare composite key in SQL server 2000
I did not know how to define composite key in a table
when we write a table with two attributes For Example
Payment Types: (typeId,paymentId,typeName)
In this table “typeId” is a primary key and paymentId is a composite Key .when we define a composite key in this table then table Does not SHOW the Key with “PaymentId”
SO Please tell me what we do for declaring the composite key in a table???
June 1, 2006 at 11:10 am
ALTER TABLE dbo.PaymentTypes ADD CONSTRAINT
PK_PaymentTypes PRIMARY KEY
(
typeid,
paymentid
)
June 1, 2006 at 11:19 am
thanks
this work you tell me how to do in Enterprise manager in sql server 2000
June 1, 2006 at 4:36 pm
Naila,
In Enterprise Manager, right-click on the table and select 'Design Table'.
Highlight the columns that you want in the primary key and click the 'set primary key' button. Save the change and you're done.
See 'Defining a primary key' in Books OnLine.
Greg
Greg
June 1, 2006 at 9:08 pm
Hi Greq Charles,
how to define Composite key in Enterprise manager?
we set the primery key but confusion in Declaring the Composite key ?
June 2, 2006 at 6:55 am
A composite key is a primary key. It's a primary key made up of more than one field.
June 2, 2006 at 7:14 am
naila, do you mean Foreign Key? That is, paymentId is the primary key in another table.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply