Re: how to create primary keys on compound fields?
From: MGFoster (me_at_privacy.com)
Date: 12/06/04
- Next message: Richard Fagen: "Re: how to create primary keys on compound fields?"
- Previous message: Richard Fagen: "how to create primary keys on compound fields?"
- In reply to: Richard Fagen: "how to create primary keys on compound fields?"
- Next in thread: Richard Fagen: "Re: how to create primary keys on compound fields?"
- Reply: Richard Fagen: "Re: how to create primary keys on compound fields?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 06 Dec 2004 22:58:44 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In the table design high-light each column name you want to make PK and
click the PK icon (a gold key symbol) in the toolbar. You high-light
each column by holding down the control key and clicking the square to
the left of the column name.
You could also use a DDL statement to create a PK:
ALTER TABLE table_name ADD CONSTRAINT PK_table_name PRIMARY KEY (col1,
col2, col3)
The coln are the column names that will comprise the PK.
-- MGFoster:::mgf00 <at> earthlink <decimal-point> net Oakland, CA (USA) -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv iQA/AwUBQbTkE4echKqOuFEgEQI7uACg3KvX6c2lJy7M9loRVsXQbs732YwAnRKD 6CSubCv+n/TA2EUvULyWke2E =qfj3 -----END PGP SIGNATURE----- Richard Fagen wrote: > Hi everyone, > > I am now getting seriously into VB.Net development as a front end to SQL > server. After working about 20 yrs with DBF's and various xBase > programs (dBase, FoxPro, Clipper, etc), I am now convinced VB/SQL is the > way to go :) > > I have a few questions: > > I've successfully imported DBF files into SQL server (MSDE) but I can't > seem to create a data adapter (in VB) unless I have a primary key > defined. Do tables require primary keys be defined prior to dragging > them onto a forms and working with datagrids? > > How can I create a primary key on a compound field? For a simple key > (one field), I know to open the server explorer, go into design mode, > then right click the field and set primary key. This works well ... but > ... what about a 'details' table where the only unique key is a > combination of many fields (might be mixed type too), ex: customer > (char) + item (numeric) + color (char). How does one do that?
- Next message: Richard Fagen: "Re: how to create primary keys on compound fields?"
- Previous message: Richard Fagen: "how to create primary keys on compound fields?"
- In reply to: Richard Fagen: "how to create primary keys on compound fields?"
- Next in thread: Richard Fagen: "Re: how to create primary keys on compound fields?"
- Reply: Richard Fagen: "Re: how to create primary keys on compound fields?"
- Messages sorted by: [ date ] [ thread ]