make table query

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

Guest

Hi there

I have a make table query which creates able. But i want to create primary
key in that table. How can i do that?
I would appreciate someone's help.

Thank you
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can't include index definitions in make-table queries. After the
make table query runs you can run one of two DDL (Data Definition
Language) statements like this:

ALTER TABLE <table name> ADD CONSTRAINT <constraint name>
PRIMARY KEY (column name[, column name[,] ])

E.g.:

ALTER TABLE Sales ADD CONSTRAINT PK_Sales
PRIMARY KEY (CustomerID, InvoiceNumber)

OR,

CREATE INDEX <index name> ON <table name>
(<column name[, column name]]) WITH PRIMARY

E.g.:

CREATE INDEX PK_Sales ON Sales
(CustomerID, InvoiceNumber ) WITH PRIMARY

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

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

iQA/AwUBQX32gIechKqOuFEgEQIxLACgi6lDYd23kwgzD2vjYH3+f5DHphQAoNIe
46o+NJGeDphh7BRu5Ypf2HdH
=2qXI
-----END PGP SIGNATURE-----
 
Back
Top