create proc Page(@PageIndex int)as declare @page intdeclare @sql varchar(1000)set @page=@PageIndex*5set @sql='select top 5 Brand.BrandID,Brand.BrandName,Brand.HtmlUrl,Brand.TypeID,Brand.LogoUrl2,Brand_Type.BrandTypeNamefrom Brand,Brand_Type where convert(int,substring(Brand.TypeID,2,1))=Brand_Type.BrandTypeId and Brand.BrandIDin (select top '+str(@page)+' BrandIDfrom Brandorder by UpdateDate Desc)and Brand.BrandIDnot in(select top '+str(((@PageIndex-1)*5))+' BrandIDfrom Brand
order by UpdateDate Desc)order by UpdateDate Desc'exec(@sql)
create proc GetBrandBBS@PageIndex int,@BrandID intasdeclare @SQL Varchar(500)beginSet @SQL='select top 4 [ID],BrandID,Title,Content,UserName,Address,AddDatefrom Brand_BBs where BrandID='+str(@BrandID)+'and [ID]in (select top '+str(4*(@PageIndex))+' [ID] from Brand_BBs where BrandID='+str(@BrandID)+' order by [ID] desc)and [ID]not in (select top '+ str(((@PageIndex-1)*4)) +' [ID] from Brand_BBS where BrandID='+str(@BrandID)+' order By [ID] desc)order by [ID] desc'end
exec (@SQL)