求解。

clxxj 2004-02-14 09:39:31
问题如下:
表tb1结构如下:
/*
create table tb1
(
[id] int identity(1,1),
cols1 money,
cols2 money,
cols3 money
)
insert into tb1(cols1,cols2,cols3)values(1,2,3)
select id=scope_identity()
insert into tb1(cols1,cols2,cols3)values(2,3,4)
select id=scope_identity()
insert into tb1(cols1,cols2,cols3)values(3,4,5)
select id=scope_identity()
*/

/*
创建一存储过程
输入参数有:
@PriceField1 varchar(50) --目标列名
@PriceField2 varchar(50) --条件列名
@strID varchar(1000) --传入ID串
@UpdateValue money --更新数值
@Condition varchar(50) --计算条件(+,-,*,/)
过程作用:以@PriceField2为条件计算出该列(传入ID串中包含的行)的最小值结合@Condition和@updatevalue
更新目标列@PriceField1的值
如:@PriceField1='cols1', @PriceField2='cols2', @strID='1'',''2', @condition='+'
如何更新@PriceField1的值.
*/
Create Procedure Test
(
@PriceField1 varchar(50),
@PriceField2 varchar(50),
@strID varchar(1000),
@UpdateValue money
)
as
begin
.......
end
...全文
34 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复

34,576

社区成员

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

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