1:利用SQL自带的存储过程
EXEC sp_pkeys @table_name='表名'
2:利用系统表INFORMATION_SCHEMA.KEY_COLUMN_USAGE
SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_NAME='表名'
1:利用SQL自带的存储过程
EXEC sp_pkeys @table_name='表名'
2:利用系统表INFORMATION_SCHEMA.KEY_COLUMN_USAGE
SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_NAME='表名'