通过执行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
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
where a.xtype=b.xtype and a.id=c.id and c.name= 'table'
AND B.NAME!='SYSNAME'
--你的是sql 200X 多少的?
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
where a.id=object_id('table') and a.xusertype=b.xusertype