4个回答
展开全部
sys.columns 试图中可以查询某个表的所有栏位信息
select a.name columnname,c.name as typename,
case when a.is_nullable = 0 then 'Not Null' else 'Null' end as nullable,a.*
from sys.columns a , sys.objects b, sys.types c
where a.object_id = b.object_id and b.name='表名'
and a.system_type_id=c.system_type_id order by a.column_id
select a.name columnname,c.name as typename,
case when a.is_nullable = 0 then 'Not Null' else 'Null' end as nullable,a.*
from sys.columns a , sys.objects b, sys.types c
where a.object_id = b.object_id and b.name='表名'
and a.system_type_id=c.system_type_id order by a.column_id
展开全部
通过系统表去查:
select c.name as tablename,a.name,b.name,a.isnullable as datatype,d.keyno from syscolumns a
inner join systypes b on a.xtype=b.xtype
inner join sysobjects c on c.id=a.id
left join sysindexkeys d on d.id=c.id and d.colid=a.colid
where c.name='yourtablename'
需要更多的信息,可以自己研究这几个表的字段和内容
select c.name as tablename,a.name,b.name,a.isnullable as datatype,d.keyno from syscolumns a
inner join systypes b on a.xtype=b.xtype
inner join sysobjects c on c.id=a.id
left join sysindexkeys d on d.id=c.id and d.colid=a.colid
where c.name='yourtablename'
需要更多的信息,可以自己研究这几个表的字段和内容
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
DESC 表名 就可以看表结构
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询