查数据字典
比如oracle
select b.column_name from user_constraints a,user_cons_columns b where a.constraint_type='p' and a.table_name='你要查的表' and a.constraint_name=b.constraint_name