create procedure GetGoodsInfoByPageNumber( @provideID int, @pageNumber int, @GoodsCountOfOnePage float, @howManyGoods int output, @howManyPage int output )asdeclare @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 @Goodsselect 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 @Goodsselect @howManyPage = Ceiling(@howManyGoods / @GoodsCountOfOnePage)select GoodsId,GoodsName,GoodsDescribe,PhotoName,SkuId,Price,MarketPrice,SkuStirng from @Goodswhere RowNumber > (@pageNumber - 1) * @GoodsCountOfOnePageand RowNumber <= @pageNumber * @GoodsCountOfOnePagegouse Daishadeclare @howManyGoods intdeclare @howManyPage intexec GetGoodsInfoByPageNumber 10,4,5,@howManyGoods out,@howManyPage outselect @howManyGoods as 商品总数select @howManyPage as 共几页-----select * from Goods where GoodsId = 177-----select * from Photos where Photos.ProvideGoodsId = 177