SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE (TABLE_NAME = 'MYTABLENAME')
但是如何只返回什么是UNIQUE键的列名?
SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC WHERE TC.TABLE_NAME = 'MYTABLENAME' AND TC.CONSTRAINT_TYPE = 'UNIQUE'