晚饭没吃用我最后一口力气问大虾一个问题

OdellaChen 2004-05-07 08:48:15
insert into total (trade_co,A,B,C,num) values(@trade_co,@a,@b,@c,1)

哪里错了
...全文
41 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
OdellaChen 2004-05-08
  • 打赏
  • 举报
回复
up~
OdellaChen 2004-05-08
  • 打赏
  • 举报
回复
alter proc s6
AS
declare @trade_co char(10),
@a char(20),
@b char(20),
@c char(20),
@k int
select @k=0
declare hh_cursor cursor for
select trade_co,
A,
B,
C
from IM_ENTRY_HEAD
where datediff(day,D_Date,getdate())=0 And LEFT(PROCESS_MARK,2)<>'1B'

open hh_cursor

fetch next from hh_cursor
into @trade_co,
@a,
@b,
@c

while @@FETCH_STATUS = 0

begin

select @k=@k+1
if exists(select trade_co where trade_co=@trade_co and A=@a and B=@b and C=@c)
begin
update total set num=num+1 where trade_co=@trade_co and A=@a and B=@b and C=@c
update total set allnum=allnum+1 where trade_co=@trade_co and A=@a and B=@b and C=@c
update total set p=num/allnum
end
else
begin
insert into total (trade_co,A,B,C,num) values(@trade_co,@a,@b,@c,1)
update total set allnum=(select distinct allnum from total where trade_co=@trade_co)
update total set p=num/allnum
end
fetch next from hh_cursor into
@trade_co,
@a,
@b,
@c

end

close hh_cursor
deallocate hh_cursor

return @k

go


exec s6

select * from total order by trade_co





zjcxc 元老 2004-05-07
  • 打赏
  • 举报
回复
将错误提示帖出来,一看便知,费事大家猜
zheninchangjiang 2004-05-07
  • 打赏
  • 举报
回复
你该看一下数据库的排序规则,
select * from syscolumns where name in ('A','B','C') --where id=object_id('total')
select * from syscolumns where name in ('a','b','c') --where id=object_id('total')
看看是不是有结果
OdellaChen 2004-05-07
  • 打赏
  • 举报
回复
不弄了,我要牺牲在回家的路上了
8992026 2004-05-07
  • 打赏
  • 举报
回复
楼上的楼上:哪填贴出小宝宝的照片???
8992026 2004-05-07
  • 打赏
  • 举报
回复
哪里错了?
数据类型不一致是很可能的
DigJim 2004-05-07
  • 打赏
  • 举报
回复
看看你的表名和字段名有沒有大小寫搞錯!!
internetcsdn 2004-05-07
  • 打赏
  • 举报
回复
同意楼主,未吃饭
internetcsdn 2004-05-07
  • 打赏
  • 举报
回复
支持一楼
zheninchangjiang 2004-05-07
  • 打赏
  • 举报
回复
没有地方错呀,前提是定义了那几个变量

34,838

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧