马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?站点注册
×
有一个分页存储过程如下 CREATE PROCEDURE GetDataByPage ( @SqlStr varchar(8000), @PageSize int, @CurrentPage int ) AS
DECLARE @FirstRec int, @LastRec int,@dt varchar(10)
BEGIN
SELECT @FirstRec = (@CurrentPage - 1) * @PageSize SELECT @LastRec = (@CurrentPage * @PageSize + 1) SELECT @dt= substring(convert(varchar,rand()),3,10) SELECT @SqlStr = stuff(@SqlStr,charindex(' FROM ',upper(@SqlStr)),6,' INTO tempdb..Paging'+@dt+' FROM ') EXECUTE (@SqlStr) SELECT @SqlStr = 'ALTER TABLE tempdb..Paging'+@dt+' ADD RID numeric(10) IDENTITY PRIMARY KEY' EXECUTE (@SqlStr) SELECT @SqlStr = 'SELECT Count(*) From tempdb..Paging'+@dt EXECUTE (@SqlStr) SELECT @SqlStr = 'SELECT * FROM tempdb..Paging'+@dt+' WHERE RID >; '+convert(varchar,@FirstRec)+' and RID < '+convert(varchar,@LastRec) EXECUTE (@SqlStr) SELECT @SqlStr = 'DROP TABLE tempdb..Paging'+@dt EXECUTE (@SqlStr) END
在java中调用,可是我的SQL语句是"select EntRegNO,EntName,QYLX,EntStatus,BuItem from td_vobject where 1=1 and EntName like '%管理有限公司'" 执行的时候报: com.sybase.jdbc2.jdbc.SybSQLException: The identifier that starts with '"set rowcount 100 select EntR' is too long. Maximum length is 28. 这个错误,是什么原因啊,请高手指教,小弟第一次用sybase数据库,谢谢 |