Цитата: ReDHawK ➤ тоже из ТОАДа
ALTER TABLE SUPERMAG.SMDOCDISCCARDSPEC ADD (
CONSTRAINT SMDOCDISCCARDSPEC_SPEC
FOREIGN KEY (DOCTYPE, DOCID, SPECITEM)
REFERENCES SUPERMAG.SMSPEC (DOCTYPE,DOCID,SPECITEM)
ON DELETE CASCADE);
правда ты версию не написал, но не думаю, что есть разница
Добавлено через 1 минуту 48 секунд
проверь, сработает, а думаю сработает, то надергаю тебе и для остальных таблиц
вот както так...
ТОка не понятно почему у меня тоад не дергал DDL полностью SQL navigator помог...
ALTER TABLE supermag.slspecpacks
ADD CONSTRAINT slcspecpacks FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE;
ALTER TABLE supermag.smcalcspecout
ADD CONSTRAINT smccalcspecout_item FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE;
ALTER TABLE supermag.smcontractpacks
ADD CONSTRAINT smccontractpacks_specitem FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE;
ALTER TABLE supermag.smdepottasks
ADD CONSTRAINT smcdepottasks_spec FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem);
ALTER TABLE supermag.smprodexpspec
ADD CONSTRAINT smcprodexpspec_item FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE;
ALTER TABLE supermag.smprodretspec
ADD CONSTRAINT smcprodretspec_item FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE;
ALTER TABLE supermag.smspecactsmeas
ADD CONSTRAINT smcspecactsmeas_item FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE;
ALTER TABLE supermag.smspecad
ADD CONSTRAINT smcspecad_spec FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE;
ALTER TABLE supermag.smspecbi_disclog
ADD CONSTRAINT smcspecbi_disclog_discid FOREIGN KEY (discid)
REFERENCES SUPERMAG.smdiscpers (code)
ALTER TABLE supermag.smspecby
ADD CONSTRAINT smcspecby FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspeccashdisc
ADD CONSTRAINT smcspeccashdisc_spec FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspeccashseller
ADD CONSTRAINT smcspeccashseller_spec FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspeccompinf
ADD CONSTRAINT smcspeccompinf_spec FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspecco
ADD CONSTRAINT smcspecco_specitem FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspecil
ADD CONSTRAINT smcspecil FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspecio
ADD CONSTRAINT smcspecio FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspecpl
ADD CONSTRAINT smcspecpl_spec FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspecrl
ADD CONSTRAINT smcspecrl FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspecserialnum
ADD CONSTRAINT smcspecserialnum FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspecscale
ADD CONSTRAINT smcspecscale_fk FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE;
ALTER TABLE supermag.smspecsr
ADD CONSTRAINT smcspecsr_fk FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smspectax
ADD CONSTRAINT smcspectax FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE
ALTER TABLE supermag.smdocdisccardspec
ADD CONSTRAINT smdocdisccardspec_spec FOREIGN KEY (doctype, docid, specitem)
REFERENCES SUPERMAG.smspec (doctype,docid,specitem) ON DELETE CASCADE