Subject | Foreign key Forensics |
---|---|
Author | Nigel Weeks |
Post date | 2004-05-11T04:58Z |
I've been having trouble getting foreign key info out of the system tables.
To describe what I'm after, here is a simple schema
CREATE TABLE tbl_farside (
str_text VARCHAR(100) NOT NULL,
PRIMARY KEY(str_text)
);
CREATE TABLE tbl_nearside (
int_id INTEGER NOT NULL,
str_text VARCHAR(100),
PRIMARY KEY(int_id),
FOREIGN KEY(str_text) REFERENCES tbl_farside ON UPDATE CASCADE
);
ok. Using the rdb$ tables, I need to find out that 'tbl_farside.str_text' is
used as a foreign key constraint by my 'nearside' table.
Imagine that tbl_farside is not known - all I know is the nearside table...
All the examples I've found around the place will give me
tbl_nearside.str_text, but not the remote(farside) end.
Hopefully this question is suitably crafted.
Nige.
Nigel Weeks
Tech Support & Systems Developer
nweeks@...
www.examiner.com.au
71 - 75 Paterson Street
Launceston
Tasmania 7250
Australia
Phone: 03 6336 7234
To describe what I'm after, here is a simple schema
CREATE TABLE tbl_farside (
str_text VARCHAR(100) NOT NULL,
PRIMARY KEY(str_text)
);
CREATE TABLE tbl_nearside (
int_id INTEGER NOT NULL,
str_text VARCHAR(100),
PRIMARY KEY(int_id),
FOREIGN KEY(str_text) REFERENCES tbl_farside ON UPDATE CASCADE
);
ok. Using the rdb$ tables, I need to find out that 'tbl_farside.str_text' is
used as a foreign key constraint by my 'nearside' table.
Imagine that tbl_farside is not known - all I know is the nearside table...
All the examples I've found around the place will give me
tbl_nearside.str_text, but not the remote(farside) end.
Hopefully this question is suitably crafted.
Nige.
Nigel Weeks
Tech Support & Systems Developer
nweeks@...
www.examiner.com.au
71 - 75 Paterson Street
Launceston
Tasmania 7250
Australia
Phone: 03 6336 7234