首页 > 数据库技术 > 详细

sql的存储

时间:2020-07-10 10:05:50      阅读:61      评论:0      收藏:0      [点我收藏+]

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

原文:https://www.cnblogs.com/XiaoyvYa/p/13277423.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!