当前位置:Gxlcms > 数据库问题 > sql的存储

sql的存储

时间:2021-07-01 10:21:17 帮助过:4人阅读

create database ZuoYe
use ZuoYe

select * from OrderInfoes
select * from Goods
select * from Shops
select c.Id,c.ShopId,c.UserId,g.Name,g.Img,g.Price,s.SName from CollectShops c
join Goods g on c.ShopId=g.ShopId
join Shops s on g.ShopId=s.Id where c.UserId=1


--退款存储过程
alter proc p_drop
(
@Reason varchar(max),
@Img varchar(max),
@Count int,
@GId int,
@UId int,
@Code int out
)
as
begin
begin try
begin tran
insert into DropOrders values (@Reason,@Img,@Count,@GId,@UId)
delete from OrderInfoes where GoodsId=@GId
update Goods set Count+=@Count where Id=@GId
commit tran
set @Code=1
end try
begin catch
rollback tran
end catch
end

declare @res int
exec p_drop ‘‘,‘‘,2,1,1,@res
select @res

sql的存储

标签:begin   rop   use   creat   ack   var   value   exec   tran   

人气教程排行