sqlserver获取字段名称和类型,有个疑问,大家进来看下啊。。

yinxiaoqi 2011-02-28 04:52:12
通过执行

select a.name,a.length,b.name from syscolumns a,systypes b,sysobjects c
where a.xtype=b.xtype and a.id=c.id and c.name= 'table'

结果如下:
name length name
id 4 int
na 100 nvarchar
ps 100 nvarchar
na 100 sysname
ps 100 sysname

现在的问题是系统的这个字段怎么过滤掉呢。
想要的结果就是这样的,

name length name
id 4 int
na 100 nvarchar
ps 100 nvarchar
...全文
72 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Vidor 2011-03-01
  • 打赏
  • 举报
回复
超,免费送你一条简单的

select a.name, a.length, b.name from syscolumns a, systypes b
where a.id=object_id('table') and a.xusertype=b.xusertype
AcHerat 2011-02-28
  • 打赏
  • 举报
回复

select a.name,a.length,b.name from syscolumns a,systypes b,sysobjects c
where a.xtype=b.xtype and a.id=c.id and c.name= 'table' and charindex('sysname',b.name) = 0
fwacky 2011-02-28
  • 打赏
  • 举报
回复

--你的是sql 200X 多少的?
SQL77 2011-02-28
  • 打赏
  • 举报
回复
select a.name,a.length,b.name from syscolumns a,systypes b,sysobjects c
where a.xtype=b.xtype and a.id=c.id and c.name= 'table'
AND B.NAME!='SYSNAME'

22,302

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧