|
ALTER PROCEDURE dbo.VerseLogPaging
Ranch
@SortColumn as varchar (100) = null,
@StartRow as int = null,
@StopRow as int = null
AS
---- Create table variable with identifier column
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)
)
---- Stop processing the query after returning the specified number of @StopRow rows
Set RowCount @StopRow
---- Inserted into the table variable
insert @t_table
(
[VerseNumber], [SubmitTime], [VerseText], [UserID])
SELECT [VerseNumber], [SubmitTime], [VerseText], [UserID]
FROM ConstructionVerseLog
order by @SortColumn
---- return to the correct result
SELECT * FROM @t_table WHERE rownum> = @StartRow
ORDER BY rownum
/ * SET NOCOUNT ON * /
RETURN
error:
1: [SubmitTime] [datetime] (20), error when declaring datetime type
2: order by @SortColumn, error when using pass parameters
How do I change it? |
|