select top 10 identity(int,1,1) id into #1 from sysobjectsinsert t1 select id where id not in (select 号 from t1 union all select 号 from t2)drop table #1
还有~`能解释一下这句是什么意思么?谢谢! select top 10 identity(int,1,1) id into #1 from sysobjects ???????
--- 100-1100 select top 1000 identity(int,100,1) id into #1 from sysobjects a,sysobjects binsert t1 (列出编号列名) select id where id not in (select 号 from t1 union all select 号 from t2) 题目不清!
select top 10 identity(int,1,1) id into #1 from sysobjects 你显示一下 select * from #1 不就是了!是得到1-10的行数
select top 1000 identity(int,100,1) id into #1 from sysobjects a,sysobjects b -----------^^^号长-------^^^^起始号!
我的意思是这样的: 我先用语句表示一下大致的意思!当然!这个语句一定不对的!但应该大家能看的懂! insert (起始号——尾号)from t1 select id where id not in (select 号 from t1 union all select 号 from t2)是这样的!难点就是*insert (起始号——尾号)from t1*这一段应该怎么写! 谢谢!
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[addNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[addNumber] GOcreate proc addNumber @start int, @length int asselect top @length identity(int,@start,1) id into #1 from sysobjects a,sysobjects binsert into T1 select * from #1 where id not in (select number from T1 union select number from T2)drop table #1本想写一个存储过程来处理的,但是在top和identity中好象不能用变量,那两个地方老是错!看看吧,当是一个提示,呵~~~~
我对SQL语句还比较陌生,你能告诉我,你下面这局话是什么意思么:if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[addNumber]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[addNumber] GO谢谢 ~
select top 10 identity(int,1,1) id into #1 from sysobjects
???????
select top 1000 identity(int,100,1) id into #1 from sysobjects a,sysobjects binsert t1 (列出编号列名) select id where id not in (select 号 from t1 union all select 号 from t2)
题目不清!
你显示一下 select * from #1 不就是了!是得到1-10的行数
是这样的~我有一个号段,100%是连号,这时,我要把这个号段写到T1的表中,但要判断一下,就是T1和T2中要是有这个号段中包含的号,那这个号段中的号就不写到T1,其他的号继续写到T1。也就是实现一个过滤的功能~(存在的号不写库)关于你的第一条语句,我知道是显示前10条或前1000条记录的~但这个有什么用处?我不太清楚~能解释一下吗?
谢谢`~(:
-----------^^^号长-------^^^^起始号!
我先用语句表示一下大致的意思!当然!这个语句一定不对的!但应该大家能看的懂!
insert (起始号——尾号)from t1 select id where id not in (select 号 from t1 union all select 号 from t2)是这样的!难点就是*insert (起始号——尾号)from t1*这一段应该怎么写!
谢谢!
drop procedure [dbo].[addNumber]
GOcreate proc addNumber
@start int,
@length int
asselect top @length identity(int,@start,1) id into #1 from sysobjects a,sysobjects binsert into T1
select * from #1
where id not in
(select number from T1
union
select number from T2)drop table #1本想写一个存储过程来处理的,但是在top和identity中好象不能用变量,那两个地方老是错!看看吧,当是一个提示,呵~~~~
drop procedure [dbo].[addNumber]
GO谢谢
~
“
服务器: 消息 207,级别 16,状态 3,过程 addNumber,行 9
列名 'number' 无效。
服务器: 消息 207,级别 16,状态 1,过程 addNumber,行 9
列名 'number' 无效。
服务器: 消息 207,级别 16,状态 1,过程 addNumber,行 9
列名 'id' 无效。
”
我的T1表字段有
号 日期 类别T2有
号 日期 类别 价格应该怎么做啊?