primary key creation using make table query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How is the primary key established when a make table query is used?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

After you've run the make-table query, run something like this:

ALTER TABLE table_name ADD CONSTRAINT PK_table_name PRIMARY KEY (col1,
col2)

col1 & col2 are the names of the columns that make up the primary key.
You can use only one column if multiple columns are not required.

IOW, you can't designate any attributes during the make-table query to
add a PK.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQf/uEoechKqOuFEgEQLscgCgsLBdZGvLJMILA2sGcI7VHbM/G0YAn0Q4
s8ruTBXct+/axa8A8RI25xg7
=3U46
-----END PGP SIGNATURE-----
 
Works like a dream thanks.

MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

After you've run the make-table query, run something like this:

ALTER TABLE table_name ADD CONSTRAINT PK_table_name PRIMARY KEY (col1,
col2)

col1 & col2 are the names of the columns that make up the primary key.
You can use only one column if multiple columns are not required.

IOW, you can't designate any attributes during the make-table query to
add a PK.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQf/uEoechKqOuFEgEQLscgCgsLBdZGvLJMILA2sGcI7VHbM/G0YAn0Q4
s8ruTBXct+/axa8A8RI25xg7
=3U46
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top