[讨论]分页存储调用出错
<p></p><div style="PADDING-RIGHT: 0px; MARGIN-TOP: 10px; FONT-SIZE: 9pt; OVERFLOW-X: hidden; WIDTH: 97%; WORD-BREAK: break-all; TEXT-INDENT: 24px; LINE-HEIGHT: normal; HEIGHT: 200px; WORD-WRAP: break-word;"><p>有一个分页存储过程如下</p><pre><code><br/>CREATE PROCEDURE GetDataByPage<br/>(<br/> @SqlStr varchar(8000),<br/> @PageSize int,<br/> @CurrentPage int<br/>)<br/>AS<br/><br/>DECLARE @FirstRec int, @LastRec int,@dt varchar(10)<br/><br/>BEGIN<br/><p></p><p> SELECT @FirstRec = (@CurrentPage - 1) * @PageSize<br/> SELECT @LastRec = (@CurrentPage * @PageSize + 1)</p><p> SELECT @dt= substring(convert(varchar,rand()),3,10)<br/> <br/> SELECT @SqlStr = stuff(@SqlStr,charindex(' FROM ',upper(@SqlStr)),6,' INTO <a href="mailto:tempdb..Paging'+@dt+'" target="_blank"><font color="#000000">tempdb..Paging'+@dt+'</font></a> FROM ')<br/> EXECUTE (@SqlStr)</p><p> SELECT @SqlStr = 'ALTER TABLE <a href="mailto:tempdb..Paging'+@dt+'" target="_blank"><font color="#000000">tempdb..Paging'+@dt+'</font></a> ADD RID numeric(10) IDENTITY PRIMARY KEY'<br/> EXECUTE (@SqlStr)<br/> <br/> SELECT @SqlStr = 'SELECT Count(*) From <a href="mailto:tempdb..Paging'+@dt" target="_blank"><font color="#000000">tempdb..Paging'+@dt</font></a><br/> EXECUTE (@SqlStr)<br/> <br/> SELECT @SqlStr = 'SELECT * FROM <a href="mailto:tempdb..Paging'+@dt+'" target="_blank"><font color="#000000">tempdb..Paging'+@dt+'</font></a> WHERE RID >; '+convert(varchar,@FirstRec)+' and RID < '+convert(varchar,@LastRec)<br/> EXECUTE (@SqlStr)<br/> <br/> SELECT @SqlStr = 'DROP TABLE <a href="mailto:tempdb..Paging'+@dt" target="_blank"><font color="#000000">tempdb..Paging'+@dt</font></a><br/> EXECUTE (@SqlStr) <br/> <br/>END</p></code></pre></div>在java中调用,可是我的SQL语句是<p>"select EntRegNO,EntName,QYLX,EntStatus,BuItem from td_vobject where 1=1 and EntName like '%管理有限公司'"</p><p>执行的时候报:</p><p>com.sybase.jdbc2.jdbc.SybSQLException: The identifier that starts with '"set rowcount 100 select EntR' is too long. Maximum length is 28.</p><p>这个错误,是什么原因啊,请高手指教,小弟第一次用sybase数据库,谢谢</p>重设rowcount
"set rowcount 100 select EntR' 太长了. 重设rowcount=28
页:
[1]