sql的存储

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的存储

上一篇:背水一战 Windows 10 (120) - 后台任务: 后台上传任务


下一篇:OAM K8s 标准实现 Crossplane 项目进入 CNCF Sandbox