I'm vinod, a junior DBA. working in HYD, india. i need one stored procedure.
Using one procedure i want to know the columns that are associated with the primary key and the name of the primary key.
The output should be as follows
Table Name PK_Constraint Name Columns
TABLE017 PK_TABLE009 COLUMN001
TABLE017 FK_TABLE009 COLUMN002
please send me the stored procedure, it will be a great help for me. thanks in advance.
vinod.mallolu@.exensys.com
vinodselect kcu.Table_Name, kcu.Constraint_Name, kcu.Column_Name from information_schema.table_constraints tc join information_schema.key_column_usage kcu
on tc.Constraint_Name = kcu.Constraint_Name and tc.Constraint_Type = 'PRIMARY KEY'
Mahesh|||i'M TRYING WITH THAT FRIEND. THANK YOU VERY MUCH FOR YOU REPLY
No comments:
Post a Comment