Create Foriegn Key
List,
How can I create a Foriegn Key after my table is created? I cannot find
in docs (or google) anywhere.
David Busby
Systems Engineer
busby@pnts.com
Hi:
On Wed, 4 Jun 2003, David Busby wrote:
List,
How can I create a Foriegn Key after my table is created? I cannot find
in docs (or google) anywhere.
Something likke this must work for you:
ALTER TABLE documento_mensaje_foro
ADD FOREIGN KEY (id_mensaje)
REFERENCES mensaje_foro ;
--
Saludos,
Roberto Andrade Fonseca
randrade@abl.com.mx
On Wednesday, June 4, 2003, at 06:59 PM, David Busby wrote:
List,
How can I create a Foriegn Key after my table is created? I
cannot find
in docs (or google) anywhere.[snip]
See Section 2.6.3 (Adding a Constraint) of the users manual included in
the 7.3.2 docs.
ALTER TABLE "foreign_table_name" ADD CONSTRAINT "fkey_name" FOREIGN KEY
("fkey_column") REFERENCES "primary_table_name"("primary_key_column_name
") ON UPDATE CASCADE ON DELETE CASCADE
(I think :-)
http://www.commandprompt.com/ppbook/index.lxp?lxpwrap=r22871%2ehtm
http://www.commandprompt.com/ppbook/index.lxp?lxpwrap=x13546.htm
Have fun, Jeff
Show quoted text
List,
How can I create a Foriegn Key after my table is created? I
cannot find
in docs (or google) anywhere.
On Wed, 4 Jun 2003, David Busby wrote:
List,
How can I create a Foriegn Key after my table is created? I cannot find
in docs (or google) anywhere.
See ALTER TABLE ADD CONSTRAINT, generally something of the form:
ALTER TABLE tablename ADD CONSTRAINT constraint name FOREIGN KEY(fkcol1)
REFERENCES pktable(pkcol1);