|
ALTER PROCEDURE dbo.VerseLogPaging
@SortColumn as varchar(100) = null,
@StartRow as int = null,
@StopRow as int = null
AS
---- 建立有标识符列的table变量
declare @t_table table
(
[rownum] [int] IDENTITY (1, 1) Primary key NOT NULL ,
[SortColumn] [varchar] (40) ,
[VerseNumber] [varchar] (20) ,
[SubmitTime] [datetime] (20) ,
[VerseText] [varchar] (500) ,
[UserID] [varchar] (20)
)
---- 在返回指定的@StopRow行数之后停止处理查询
Set RowCount @StopRow
---- 插入到table变量中
insert @t_table
(
[VerseNumber],[SubmitTime],[VerseText],[UserID])
SELECT [VerseNumber],[SubmitTime],[VerseText],[UserID]
FROM ConstructionVerseLog
order by @SortColumn
---- 返回到正确的结果
SELECT * FROM @t_table WHERE rownum >= @StartRow
ORDER BY rownum
/* SET NOCOUNT ON */
RETURN
错误:
1:[SubmitTime] [datetime] (20) ,声明datetime类型时出错
2:order by @SortColumn ,使用传递参数时出错
请问要如何修改啊 |
|