存储过程排序问题?
发布网友
发布时间:2022-04-15 03:50
我来回答
共2个回答
热心网友
时间:2022-04-15 05:19
得用动态语句:
Create PROCEDURE P_Test
(
@SortBy NVARCHAR(100) = 'Column1'
)
AS
BEGIN
exec('
SELECT * FROM
( SELECT row_number() OVER ( ORDER BY '+@SortBy+' ASC ) AS Row_ID, t.* FROM
(
Select * from dbo.Table) AS t
)
AS page WHERE page.Row_ID BETWEEN 1 AND 10
')
END
热心网友
时间:2022-04-15 06:37
是不是应该要用 oeder by