USE [WEBCITY]sql2000不能用吗???
GO
/****** Object: StoredProcedure [dbo].[spAll_ReturnRows] Script Date: 07/14/2013 19:34:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spAll_ReturnRows]
(
@SQL nVARCHAR(4000),
@Page int,
@RecsPerPage int,
@ID VARCHAR(255),
@Sort VARCHAR(255)
)
AS
DECLARE @Str nVARCHAR(4000)
if CHARINDEX(@ID,@Sort) =0
begin
set @[email protected]+',[email protected]
end
SET @Str='SELECT TOP '+CAST(@RecsPerPage AS VARCHAR(20))+' * FROM ([email protected]+') T WHERE [email protected]+' NOT IN
(SELECT TOP '+CAST((@RecsPerPage*(@Page-1)) AS VARCHAR(20))+' [email protected]+' FROM ([email protected]+') T9 ORDER BY [email protected]+') ORDER BY [email protected]
PRINT @Str
EXEC sp_ExecuteSql @Str
SQL
------解决方案--------------------
[email protected]