2、
select
a.name,
case when b.id is null then '存在' else '不存在' end
from
(select id,name from sysobjects where xtype='U') a
left join
(select id from syscolumns where name='ID') b
on
a.id = b.id
select
a.name,
case when b.id is null then '存在' else '不存在' end
from
(select id,name from sysobjects where xtype='U') a
left join
(select id from syscolumns where name='ID') b
on
a.id = b.id
解决方案 »
- 怎么从一个数据库中的几天的考勤数据插入到另一个数据库中的表中
- 企业管理器打不开问题
- 时常为字段的命名发愁
- 三张行数在10万行的数据表的连接
- 导入数据问题 求高手解答
- sql server2005还原时,选项除了数据文件,日志文件还多了一个文件导致还原
- 几百条数据丢了,怎么才能找回了,急死了。。。
- 大哥大姐,高分求教一段关于日期的SQL
- 怎么样用T_SQL来删除赋予库与表的权限~!?
- 关于SQL中存储过程的一个小问题
- 这个帖子的给分帖:http://community.csdn.net/Expert/topic/4346/4346391.xml?temp=.7424738
- 求一SQL语句。更新一个字段值为一个顺序编号。
a.name,
case when b.id is null then '不存在' else '存在' end
from
(select id,name from sysobjects where xtype='U') a
left join
(select id from syscolumns where name='ID') b
on
a.id = b.id
select count(*) from syscolumns where id = object_id('表名')
--2:?取某一个表的所有字段select name from syscolumns where id=object_id('表名')--6:??某一个表的字段和数据?型select column_name,data_type from information_schema.columns
where table_name = '表名'
set @tn = ''
select @tn=@tn+'['+[name]+'],' from dbo.sysobjects where xtype = 'U'
set @tn ='select * from '+ left(@tn,len(@tn)-1)
exec(@tn)
aa.name,
case when bb.id is null then '不存在' else '存在' end
from
(select id,name from sysobjects where xtype='U') aa
left join
(select id from syscolumns where name='ID') bb
on
aa.id = bb.id--sysobjects 和syscolumns 都是系统表,记录着用户表的信息