473,659 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Names of columns with foreign keys

1 New Member
Can anybody help me with such problem:
I need to get all columns names which have foreign key constraint.
For example:
I have table my_table with column my_column, and this column have foreign key constraint. What sql code will return me the name of this column if I know the name of it's foreign key constraint. In constraint_colu mn_usage table we can find related table column name, but it is not exactly what i need.
I can't find table in information_sch ema which contains this information.

Thanks for any help.
Dec 7 '07 #1
1 4118
rski
700 Recognized Expert Contributor
Can anybody help me with such problem:
I need to get all columns names which have foreign key constraint.
For example:
I have table my_table with column my_column, and this column have foreign key constraint. What sql code will return me the name of this column if I know the name of it's foreign key constraint. In constraint_colu mn_usage table we can find related table column name, but it is not exactly what i need.
I can't find table in information_sch ema which contains this information.

Thanks for any help.
Maybe like this
select column_name from information_sch ema.key_column_ usage where table_name=your _table;
Dec 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
49721
by: Olivier Crèvecoeur | last post by:
Hello, Excuse me for my poor english. I would kike know if create index on the foreign key it's necessary or if Oracle, are optimized for using foreign key whithout index. Best regards Olivier
31
3367
by: Robert Brown | last post by:
Let's say I have a type hierarchy: (just an example) the general entity customer: CREATE TABLE customer(customer_id int, customer_name varchar(250), customer_type int) three specific customer subtypes: 1 - business, 2 - home, 3 - university
1
6255
by: Dag | last post by:
Hi, I tried to create a simple view as follows CREATE VIEW V_ALL_USERTABLE_COLUMNS AS ( SELECT OBJ.NAME as TableName, COL.NAME as ColName,
1
2993
by: Vinodh Kumar P | last post by:
I understand the number of foreign keys allowed is restricted by the DBMS I use. In a general relational schema design perspective how many foreign keys a table shall have? If I have large number of foreign keys what anamolies it will lead to? Is this crucial to identify all the foriegn key relationships for a table? Vinodh
2
2515
by: Ian Davies | last post by:
I have created a database with about 17 tables. I have been creating foreign keys some of which have worked but when creating others I get the message below ************************* 1005 (ER_CANT_CREATE_TABLE) Cannot create table. If the error message refers to errno 150, table creation failed because a foreign key constraint was not correctly formed.
9
3904
by: sonal | last post by:
Hi all, I hv started with python just recently... and have been assigned to make an utility which would be used for data validations... In short we take up various comma separated data files for eg: area.txt, school.txt, students.txt.... and so on (ok?!?) now, 1. area code used in the school.txt must be defined in the area.txt (Primary key in area => area_code defined in area.txt & Foreign key on school => area_code defined in...
1
10994
by: apax999 | last post by:
Kinda new to SQL, using SQL Server 2005. I have some foreign keys in a couple of tables. I need to drop these tables, but can't since I'll get the error: Msg 3726, Level 16, State 1, Line 1 Could not drop object 'Client' because it is referenced by a FOREIGN KEY constraint.
0
3027
by: Frank Swarbrick | last post by:
So we're trying to decide if it's better to use IDENTITY columns or sequences to create a surrogate key as the primary key for our tables. I kind of like the identity column, because it's more 'tightly integrated' in to the table. With a sequence you have to make sure that each application that inserts records uses the same sequence. (Probably not likely that it wouldn't, but...) One thing where it seems like a SEQUENCE would be...
2
1106
by: lazyvlad | last post by:
Hi people, I thought I had a simple problem ahead of me but it turns out it ain't that simple as I hoped it would be. So here is the problem: I've got a table in a dataset which acts like a join table to other parent tables making a many to many relation. Got two foreign keys in it which are related to their master tables, problems is I want to make the combination of the two foreign keys act like an unique entry. To be more precise,...
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.