answersLogoWhite

0

-- two dashes mean a comment in DB2 for VM and z/OS

-- 1st design your table - considered optional

-- 2nd declare your table - maditory. You still can not alter a table that

-- does not exist

-- 3rd alter the table to add the foreign key

-- DB2 for FOREIGN KEY

ALTER TABLE owner.Tablename

ADD CONSTRAINT name FOREIGN KEY (column name(s) )

REFERENCES REDBA.RESF_FINAL_CARD (column name(s) )

ON DELETE RESTRICT -- means stop them

or

ON DELETE cascade -- Cascade means to delete everthing here

or

ON DELETE SET value -- update the value of the column

;

-- note since you are doing DDL not dml the commit is implicit!! so

-- there is no COMMIT WORK needed

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How do you connect the rad and db2?

how to connect the rad to db2


What company owns DB2?

The DB2 is owned by Aston Martin.


What is SQL0668N Operation not allowed for reason code 7 on table in db2?

The SQL0668N error in DB2 indicates that an operation attempted on a table is not allowed due to reason code 7, which usually relates to a constraint violation. Check the constraints defined on the table and ensure that the operation being performed is compliant with those constraints. This error typically occurs when trying to insert or update data that violates a constraint such as a foreign key constraint.


Who can declare war on foreign countries in the US?

congress


Can we use IBM dB2 in PCs?

Yes, DB2 install is available for PCs (Windows)


The key foreign policymakers are?

The key foreign policy makers are?


Can a foreign key be null?

yes .a foreign key can have null values


What did the neutrality acts declare that the US would do?

stay out of foreign conflict


Which is the lowest cost db2 product that can be legally installed on an hp ux server?

DB2 enterprise server edition


The foreign key uniquely identifies a record in a table T or F?

False. A foreign key is a primary of one table that is in another table. A foreign key can be repeated, so it does not uniquely identify records in the table where it is a foreign key.


Who let's the president declare war?

The President can not declare war. Only Congress can declare war, usually at the request of the President. Subject to limitations by Congress, the president can take military action. For example, the can order the bombing of foreign targets or send troops into a foreign country.


How do you use foreign key in to oracle?

the foreign key referential between two tables.