DaishaPocedureOfMine(代码)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DaishaPocedureOfMine(代码)相关的知识,希望对你有一定的参考价值。

create procedure GetGoodsInfoByPageNumber
(
    @provideID int,
    @pageNumber int,
    @GoodsCountOfOnePage float,
    @howManyGoods int output,
    @howManyPage int output
    
)
as
declare @Goods table
(
    RowNumber int,
    GoodsId int,
    GoodsName varchar(50),
    GoodsDescribe varchar(200),
    PhotoName varchar(200),
    SkuId int,
    Price money,
    MarketPrice money,
    SkuStirng varchar(200)
)
insert into @Goods
select ROW_NUMBER() over (order by Goods.GoodsId),
GoodsId,GoodsName,GoodsDescribe,PhotoName,SkuId,Price,MarketPrice,SkuStirng from Goods,Photos,Sku where Goods.GoodsId in (select GoodsId from Goods where Goods.ProvideCateId = @provideID) and Photos.ProvideGoodsId = Goods.GoodsId and Photos.FatherPhotoId is null and Photos.PhotoIdentity = 1 and Sku.ProvideGoodsId = Goods.GoodsId and Sku.SkuIdentity = 1
----给输出参数赋值
select @howManyGoods = COUNT(GoodsId) from @Goods
select @howManyPage = Ceiling(@howManyGoods / @GoodsCountOfOnePage)

select GoodsId,GoodsName,GoodsDescribe,PhotoName,SkuId,Price,MarketPrice,SkuStirng from @Goods
where RowNumber > (@pageNumber - 1) * @GoodsCountOfOnePage
and RowNumber <= @pageNumber * @GoodsCountOfOnePage
go

use Daisha
declare @howManyGoods int
declare @howManyPage int
exec GetGoodsInfoByPageNumber 10,4,5,@howManyGoods out,@howManyPage out
select @howManyGoods as 商品总数
select @howManyPage as 共几页

-----select * from Goods where GoodsId = 177
-----select * from Photos where Photos.ProvideGoodsId = 177

 

以上是关于DaishaPocedureOfMine(代码)的主要内容,如果未能解决你的问题,请参考以下文章

网络爬虫作业代码代写代实现代做爬虫程序

python 图像归一化作业代码代编程代写图python作业

R 作业代写代编代码Thinking and Reasoning

低代码平台如何代客户开发

代写Haskell程序 汉诺塔汉诺塔编程代码代写

java程序代码代写代写tree数据结构作业