use zgwpjh
go
if exists(select top 1 name from sysobjects where name= 'Edit_product ' and type= 'p ')
drop proc Edit_product
go
Create Procedure [dbo].[Edit_product]
(
@pid int,
@pic varchar(150),
@wpmc varchar(50),
@xjcd int,
@wpsl int,
@catecode varchar(250),
@wpms text,
@isshow int,
@jhqy varchar(150),
@jhtj varchar(4000),
@wpproperty varchar(250),
@wpzr varchar(50),
@mycategory varchar(50)
)
as
declare @n int
declare @i int
declare @k int
declare @Lstr1 int
declare @Lstr2 int
declare @mycate varchar(200)
declare @property varchar(250)
set xact_abort on
begin tran
if @catecode <> ' '
--更新物品类别总量
select @Lstr1=len(物品类别)/4 from products where [email protected] --取得老类别
Set @i=0
WHILE @i < @Lstr1
BEGIN
Set @i [email protected] +1
Update Category set pcount=pcount-1 Where CateCode=Substring(@CateCode,1,@i*4) --老类别上减一
END
Set @Lstr2 = Len(@catecode)/4
Set @k=0
WHILE @k < @Lstr2
BEGIN
Set @k [email protected] +1
Update Category set pcount=pcount+1 Where CateCode=Substring(@CateCode,1,@k*4) --新类别上增一
END
--更新物品类别总量结束
--产品信息入库
if @pic= ' '
if @catecode= ' '
begin
update products set [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected] where [email protected]
end
else
begin
update products set [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected] where [email protected]
end
else
if @catecode= ' '
begin
update products set [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected] where [email protected]
end
else
begin
update products set [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected] where [email protected]
end
--产品入库结束
--更新当前物品的属性
select @property=属性 from products where [email protected]
if @property <> ' '
UPdate Cate_Property_value set pcount=pcount-1 where valueid in(@property)
if @wpproperty <> ' '
UPdate Cate_Property_value set pcount=pcount+1 where valueid in(@wpproperty)
--更新物品属性总量结束
select @mycate=我的类别 from products where [email protected]
update mycategory set pcount=pcount-1 where [email protected] and [email protected]
if @mycategory <> ' '
update mycategory set pcount=pcount+1 where [email protected] and [email protected]
commit tran
现在的问题是
涉及到运算的代码都不执行