select *
from sys.key_constraints
exec sp_pkeys 'tablename'
exec sp_fkeys'tablename'
SELECT A.NAME AS 表名,B.NAME AS 主键名
FROM SYSOBJECTS A JOIN SYSOBJECTS B ON A.ID=B.PARENT_OBJ
AND A.XTYPE='U' AND B.XTYPE='PK'
SELECT TABLE_NAME,COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_NAME='tablename'