[求助]表的是否为主键在什么系统表里
RT.谢谢
不呀,这个存储过程我以前就会.
它好像不能指定列名吧!
你看一下我写的吧,帮我改一下.谢谢
declare @objid int
declare @objname char(40)
select @objname = 'tablename'
select @objid = id from sysobjects where id=object_id(@objname)
select a.name as '列名',b.name as '数据类型',a.length as '长度',
(case when a.isnullable='1' then '是'else '否'end ) as '允许空'
from syscolumns a,systypes b where a.id = @objid and b.xtype in
(select xtype from syscolumns where id = @objid )
现在就要判断其主键了,我就不知道怎么判断了.