select
c.CONSTRAINT_NAME,c.TABLE_NAME,c.COLUMN_NAME
from
INFORMATION_SCHEMA.TABLE_CONSTRAINTS t
join INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE c
on t.CONSTRAINT_NAME=c.CONSTRAINT_NAME
where CONSTRAINT_TYPE='PRIMARY KEY'
c.CONSTRAINT_NAME,c.TABLE_NAME,c.COLUMN_NAME
from
INFORMATION_SCHEMA.TABLE_CONSTRAINTS t
join INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE c
on t.CONSTRAINT_NAME=c.CONSTRAINT_NAME
where CONSTRAINT_TYPE='PRIMARY KEY'
要获取数据库构架, 需要从专门的数据库中获取.