查看数据库表主键


 --查看指定表的主键

select * from sysobjects where parent_obj in(
select id ,* from sysobjects where name='表名')
and xtype='PK'
--查看所有表
select * from sysobjects where xtype='PK'

 

posted @ 2012-03-25 13:24  qingsong_do  阅读(1561)  评论(0编辑  收藏  举报