小弟我写了一个存储过程,请高手看看,有没有那个地方有错,或者有更好的办法
CREATE PROCEDURE order_tot_amt
@o_shopcode int,--店铺编号
@n_name varchar(50),--用户姓名@d_begindate DateTime,--开始时间
@d_enddate DateTime,--结束时间@p_totnum int output,--总数量
@p_totamount int output--总金额@p_tienum int output,--搭配数量
@p_tieamount int output--搭配金额@p_tienumpro int output,--搭配数量率
@p_tieamountpro int output--搭配金额率AS
--查询 总数量@p_totnum,总金额@p_totamout。
select @p_totnum=sum(sell_Salenum) as 总数量,@p_totamout=sum(sell_totalamount) as 总金额
from dmsshopsell,cusgroup, CUSGROUPSETING where
dmsshopsell.shop_Code like '%'+rtrim(@o_shopcode)+'%' and (sell_saledate between @d_begindate and @d_enddate)
and dmsshopsell.shop_code = cusgroupseting.shop_code and cusgroup.group_Id = CUSGROUPSETING.group_id and group_name = @n_name
group by dmsshopsell.shop_Code
--查询 搭配数量@p_tienum,搭配金额@p_tieamount----------------------------------------------------------------------------------
select @p_tienum=sum(sell_Salenum)as 搭配数量,@p_tieamount=sum(sell_totalamount) as 搭配金额
from dmsshopsell,cusgroup, CUSGROUPSETING where
dmsshopsell.shop_Code like '%'+rtrim(@o_shopcode)+'%' and (sell_saledate between @d_begindate and @d_enddate) and sell_salenum>=2
and dmsshopsell.shop_code = cusgroupseting.shop_code and cusgroup.group_Id = CUSGROUPSETING.group_id and group_name = @n_name
group by dmsshopsell.shop_Code
--将搭配数量率和搭配金额率算出,并插入新表tiepro-----------------------------------------------------------------------------
INSERT INTO tiepro VALUES shop_code=@o_shopcode,tienumpro = @p_tienum/@p_totnum ,tiemoney = @p_tieamount/@p_totamount
--查询 搭配数量率@p_tienumpro,搭配金额率@p_tieamountpro-------------------------------------------------------------------------
select @p_tienumpro=tienumpro,@p_tieamountpro=tiemoney from tiepro where shop_code=@o_shopcodeGO
我asp.net页面想用repeter来绑定数据,那么我Eval 的参数是什么呢?
注释都很清楚,有问题也可以QQ联系,也欢迎高手指教!309911833 !
邮箱[email protected].
大家有问题一起讨论
回答满意,还可以加分。
CREATE PROCEDURE order_tot_amt
@o_shopcode int,--店铺编号
@n_name varchar(50),--用户姓名@d_begindate DateTime,--开始时间
@d_enddate DateTime,--结束时间@p_totnum int output,--总数量
@p_totamount int output--总金额@p_tienum int output,--搭配数量
@p_tieamount int output--搭配金额@p_tienumpro int output,--搭配数量率
@p_tieamountpro int output--搭配金额率AS
--查询 总数量@p_totnum,总金额@p_totamout。
select @p_totnum=sum(sell_Salenum) as 总数量,@p_totamout=sum(sell_totalamount) as 总金额
from dmsshopsell,cusgroup, CUSGROUPSETING where
dmsshopsell.shop_Code like '%'+rtrim(@o_shopcode)+'%' and (sell_saledate between @d_begindate and @d_enddate)
and dmsshopsell.shop_code = cusgroupseting.shop_code and cusgroup.group_Id = CUSGROUPSETING.group_id and group_name = @n_name
group by dmsshopsell.shop_Code
--查询 搭配数量@p_tienum,搭配金额@p_tieamount----------------------------------------------------------------------------------
select @p_tienum=sum(sell_Salenum)as 搭配数量,@p_tieamount=sum(sell_totalamount) as 搭配金额
from dmsshopsell,cusgroup, CUSGROUPSETING where
dmsshopsell.shop_Code like '%'+rtrim(@o_shopcode)+'%' and (sell_saledate between @d_begindate and @d_enddate) and sell_salenum>=2
and dmsshopsell.shop_code = cusgroupseting.shop_code and cusgroup.group_Id = CUSGROUPSETING.group_id and group_name = @n_name
group by dmsshopsell.shop_Code
--将搭配数量率和搭配金额率算出,并插入新表tiepro-----------------------------------------------------------------------------
INSERT INTO tiepro VALUES shop_code=@o_shopcode,tienumpro = @p_tienum/@p_totnum ,tiemoney = @p_tieamount/@p_totamount
--查询 搭配数量率@p_tienumpro,搭配金额率@p_tieamountpro-------------------------------------------------------------------------
select @p_tienumpro=tienumpro,@p_tieamountpro=tiemoney from tiepro where shop_code=@o_shopcodeGO
我asp.net页面想用repeter来绑定数据,那么我Eval 的参数是什么呢?
注释都很清楚,有问题也可以QQ联系,也欢迎高手指教!309911833 !
邮箱[email protected].
大家有问题一起讨论
回答满意,还可以加分。
解决方案 »
- 在hotmail里不能显示TD,background-img图片,在线等,100分
- 一个很菜的图片上传问题,大家看下,急!!!
- 晕晕的问一个简单问题如何清除textbox里历史记录
- 请大家介绍下好的收费的虚拟空间提供商或者vps提供商
- 调查:你们公司用了VSS吗?你们公司每个项目都能遵循>=80%的软件工程标准吗?
- asp.net2.0中如何绑定onmousedown事件?
- 请教高手如何后期改变服务器控件的颜色?
- 经常看到下面的代码,中的get和set不知是什么意思,主要用于什么?起什么样的作用。。我们在什么地方需要用到它呢?
- 变量传递的问题?
- datagrid 与<a STYle="CURSOR: hand" onclick="a1(2)">AAA</A>问题
- VS2010 在删除文件时错误!研究好久都解决不了~求高手!!
- [求助]Visual Studio ReportViewer 内存泄露问题
INSERT INTO tiepro VALUES shop_code=@o_shopcode,tienumpro = @p_tienum/@p_totnum ,tiemoney = @p_tieamount/@p_totamount这是什么语言?insert into [user] values (@ids,@name,@sex,@sate)
但是加了后却是这样在此上下文中不允许使用名称 "shop_code"。有效表达式包括常量、常量表达式和变量(在某些上下文中)。不允许使用列名。
INSERT INTO tiepro VALUES (@o_shopcode,@p_tienum/@p_totnum ,@p_tieamount/@p_totamount)有关
参考
DECLARE @p_totamount_for int
DECLARE @p_tienum_for int
DECLARE @p_tieamount_for int
DECLARE @p_tienumpro_for int
DECLARE @p_tieamountpro_for int exec order_tot_amt @o_shopcode ='1', @n_name='戴超' ,@d_begindate='2010-1-1',@d_enddate='2011-1-1'
,@p_totnum =@p_totnum_for output,--总数量
@p_totamount =@p_totamount_for output,--总金额@p_tienum =@p_tienum_for output,--搭配数量
@p_tieamount =@p_tieamount_for output,--搭配金额@p_tienumpro =@p_tienumpro_for output,--搭配数量率
@p_tieamountpro =@p_tieamountpro_for output--搭配金额率
PRINT Convert(varchar(50),@p_totnum_for) +'a'+ Convert(varchar(50),@p_totamount_for) +'a'+ Convert(varchar(50),@p_tienum_for) +'a'+ Convert(varchar(50),@p_tieamount_for) +'a'+ Convert(varchar(50),@p_tienumpro_for) +'a'+ Convert(varchar(50),@p_tieamountpro_for)
select @p_tienumpro=tienumpro,@p_tieamountpro=tiemoney from tiepro where shop_code=@o_shopcode这里面,我得到的@p_tienumpro,@p_tieamountpro 都是0,
INSERT INTO tiepro VALUES (@o_shopcode,@p_tienum/@p_totnum ,@p_tieamount/@p_totamount)
select @p_tienumpro=tienumpro,@p_tieamountpro=tiemoney from tiepro where shop_code=@o_shopcode
你的问题是,你values,前面没有参数的,也就是说你再values后面括号中要给每个字段都赋上值,没值的你也要给个空啊?你的@p_tienum/@p_totnum ,应该没有插入到tienumpro这个字段中,只是放到了第二个字段上了,你直接select *from tiepro 看看,你的值是不是进去了、