>데이터 베이스 >MySQL 튜토리얼 > 关于存储过程的。。。

关于存储过程的。。。

WBOY
WBOY원래의
2016-06-07 17:44:16962검색

USE [jcCmsDb] GO /****** 对象: StoredProcedure [dbo].[up_DataPageRowNumber] 脚本日期: 04/25/2013 20:06:12 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE[dbo].[up_DataPageRowNumber] @SQL Nvarchar(2000), @Order Nvar

USE [jcCmsDb]
GO
/****** 对象: StoredProcedure [dbo].[up_DataPageRowNumber] 脚本日期: 04/25/2013 20:06:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE[dbo].[up_DataPageRowNumber]
@SQL Nvarchar(2000),
@Order Nvarchar(40),
@PageIndex int,
@PageSize int,
@TotalRecorder int output
AS
BEGIN
SET NOCOUNT ON;
declare @ExceSQL nvarchar(4000)
declare @start_row_num AS int
SET @start_row_num=(@PageIndex-1)*@PageSize+1
declare @end_row_num int
set @end_row_num=@PageIndex*@PageSize
declare @RowNumber nvarchar(100)
set @RowNumber=',ROW_NUMBER() OVER(ORDER BY '+@Order+')as RowNumber from'
set @SQL=Replace(@SQL,'from',@RowNumber)
set @ExceSQL='select @TotalRecorder=max(RowNumber)from(' +@SQL+ ')as tmp'
execute sp_executesql @ExceSQL,N'@TotalRecorder int output',@TotalRecorder output
set @ExceSQL = 'select*from(' + @SQL + ') as tmp where RowNumber between' +Convert( nvarchar,@start_row_num)
+ 'And' +Convert( nvarchar,@end_row_num)
print @ExceSQL
execute(@ExceSQL)
END

declare @a int
exec up_DataPageRowNumber "select * from jc_Article","Id",2,2,@a output
print @a

为什么会一直抱这个错??抓狂。。。。

select*from(select * ,ROW_NUMBER() OVER(ORDER BY Id)as RowNumber from jc_Article) as tmp where RowNumber between3And4
消息 4145,级别 15,香港服务器租用,状态 1,香港空间,虚拟主机,第 1 行
在应使用条件的上下文(在 'between3And4' 附近)中指定了非布尔类型的表达式。

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.