select
(select sum(ssy) from N_Study where sid='18' and (ssy >'70' and ssy <='80'))as ds1,
(select sum(ssy) from N_Study where sid='18') as sss1 ,
(select top 1 '70-80' from N_study where sid = '18' ) as dsj1
into #tmp
insert into #tmp
select
(select sum(ssy) from N_Study where sid='18' and (ssy >'80' and ssy <='90'))as ds2,
(select sum(ssy) from N_Study where sid='18') as sss2,
(select top 1 '80-90' from N_study where sid = '18' ) as dsj2
select * from #tmp
drop table #tmp
出现错误信息
服务器: 消息 8152,级别 16,状态 9,行 11
将截断字符串或二进制数据。
语句已终止。
服务器: 消息 8152,级别 16,状态 9,行 16
将截断字符串或二进制数据。
语句已终止。
如果是单段执行就行,
要怎么检查呢,帮帮忙,帮我改一下
单段是哪段呢?还是两段分别执行的时候?
追问(select sum(ssy) from N_Study where sid='18' and (ssy >'70' and ssy <='80'))as ds1,
(select sum(ssy) from N_Study where sid='18') as sss1 ,
(select top 1 '70-80' from N_study where sid = '18' ) as dsj1
select * from #tmp
drop table #tmp
可以
我觉得应该是(select top 1 '80-90' from N_study where sid = '18' ) as dsj2
这句是否有后续的,比如'90-100'这样的输入?这样的话应该就会报错了
因为select into语句中的字符长度只会是最初运行时那个字符的长度,
后续如果插入更长的话就会报错了
如果我把'70-80' 改成80可以吗,不可以的话请问我要怎么改呢大侠
追答我的意思是这样,你前面写的'70-80',那么临时表被创建成这个字段只有长度5
如果你后面写'90-100'这样字符长度为5以上的就报错了
可以这样修改convert(varchar(20),'70-80')
可以帮我处理一下DELPHI吗大侠,加我的QQ可以吗2729010
追答DELPHI不会啊,sql语句的话就照我上面说的改就行了