列中有数据INT类型,1 4 5 7 8 9怎样自动查出2 3 6
解决方案 »
- 如何在存储过程加事务回滚
- XQuery 遵循的是 ANSI-SQL 92 标准吗?
- 请教各位高手,如何在存储过程中将一个文本文件FTP至另一台机器?
- 主表和辅表组成视图(一对多),能不能不显示重复项
- SQL 2005中怎么用smalldatatime
- 为什么top @a 不可用??(看看这段程序(有点难度,主要是乱)_
- 触发器针对删除怎么未响应?
- 怎样自动得到数据库里面表的结构,如数据类型,长度,是否为空?
- 怎样使图片加载在sql数据库中,而图片不是以文件的形式存在的呀?请高手赐教!
- 高分请教:关于批量处理中的触发器问题?在线等。
- 白送分,做过ASP+SQL SERVER 2000数据库编程的进!!!
- 这段SQL为什么在sql2000上出错?
(
select 1 as id
Union all select 2 Union all select 3
Union all select 4 Union all select 5
Union all select 6 Union all select 7
Union all select 8 Union all select 9
) aa
where id not in (select 你的列 from 你的表)
( id int)
insert into T
select 1 union
select 4 union
select 6 union
select 8 union
select 10 union
select 11declare @max int select @max =max(id) from Tset rowcount @max
select identity(int,1,1) as num into # from sysobjects,syscolumns
set rowcount 0
select num from # where num not in (select id from T)drop table #,T测试了.你试试
create table T( id int)
insert into T
select 1 union
select 4 union
select 6 union
select 8 union
select 10 union
select 11
--查询语句
select id-1 as 缺号 from t a where id>1 and not exists(select * from t where id=a.id-1)