SHOW INDEX FROM `tablename` WHERE key_name = 'PRIMARY'
http://dev.mysql.com/doc/refman/5.0/en/show-index.html

- mike

On 4/02/2009 16:39, Aaron Cooper wrote:
> Hi All,
> Can't find anything on this in the docs. Does anyone know of a way off 
> the top of their head how you can return the name of a table's primary 
> key using SQL.
> I've figured out how to get foreign keys using the 
> REFERENCED_COLUMN_NAME constant, but there doesn't appear to be any 
> such constant for Primaries.
> Cheers
> Aaron
>
> >


-- 
Mike Cochrane
Web Team Leader

gardyneHOLT - design partners
18 Beresford Square Newton
PO Box 3340 Auckland New Zealand
p +64 9 300 3155  f +64 9 302 3349  m 021 545 565
skype gardyneholt_mikec
www.gardyneholt.co.nz

DISCLAIMER:  This electronic message, together with any attachments, was 
created solely for the use of the intended recipient(s), and may be 
confidential. Views expressed may be those of the individual sender and are not 
necessarily endorsed by gardyneHOLT. If you are not the intended recipient, 
please advise us by return e-mail that you have received the message in error 
and then delete it. Do not copy, disclose or use the contents in any way.


--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to