Aaron Cooper wrote, on 4/02/2009 3:08 PM:
Hi Aaron, select COLUMN_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where CONSTRAINT_NAME = 'PRIMARY' AND CONSTRAINT_SCHEMA = 'database_name' AND TABLE_NAME = 'table_name'; Will give you the PK for the table 'table_name' within the database 'database_name'. Cheers, Stig --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~--- |
- [phpug] [OT] Get Primary Key column name using SQL Aaron Cooper
- [phpug] Re: [OT] Get Primary Key column name using SQL Paul Brouwers
- [phpug] Re: [OT] Get Primary Key column name using SQL Stig Manning
- [phpug] Re: [OT] Get Primary Key column name using... Aaron Cooper
- [phpug] Re: [OT] Get Primary Key column name u... Stig Manning
- [phpug] Re: [OT] Get Primary Key column name u... Keith Allpress
- [phpug] Re: [OT] Get Primary Key column name using SQL Mike Cochrane
