日期:2014-05-16 浏览次数:20539 次
---存储过程
if object_id('gettable') is not null
drop PROCEDURE gettable
go
CREATE PROCEDURE gettable
@orderField varchar(200), ---排序字段
@orderType varchar(200), ---排序顺序,是降序,升序还是
@StartRow int, --开始页
@MaxiRow int ---总共多少页
as
begin
select f.id,f.ShelfName,f.StorehouseId,f.Description,f.CreateUserId,f.CreateUserName,f.CreateTime,f.ModifyUserId,
f.ModifyUserName,f.ModifyTime,f.SortCode,f.Default1,f.Default2,f.Default3,f.Default4,f.Default5,s.StoreName
into #GF from DY_Shelf f left join dbo.DY_Storehouse s on f.StorehouseId = s.id
Select * From
(Select ROW_NUMBER() Over(Order By '+' @orderField '+' @orderType'+') As rowNum ,*
From (select * from #GF) As T ) As N
Where rowNum >= @StartRow And rowNum <= @MaxiRow
drop table #GF
end
GO
---存储过程
if object_id('gettable') is not null
drop PROCEDURE gettable
go
CREATE PROCEDURE gettable
@orderField varchar(200), ---排序字段
@orderType varchar(200), ---排序顺序,是降序,升序还是
@StartRow int, --开始页
@MaxiRow int ---总共多少页
as
begin
select f.id,f.ShelfName,f.StorehouseId,f.Description,f.CreateUserId,f.CreateUserName,f.CreateTime,f.ModifyUserId,
f.ModifyUserName,f.ModifyTime,f.SortCode,f.Default1,f.Default2,f.Default3,f.Default4,f.Default5,s.StoreName
into #GF from DY_Shelf f left join dbo.DY_Storehouse s on f.StorehouseId = s.id
declare @sql varchar(80