sybasefa 发表于 2007-3-21 09:27:06

[讨论]分页存储调用出错

<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/>&nbsp;&nbsp;&nbsp; @SqlStr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; varchar(8000),<br/>&nbsp;&nbsp;&nbsp; @PageSize&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int,<br/>&nbsp;&nbsp;&nbsp; @CurrentPage&nbsp;&nbsp;&nbsp; int<br/>)<br/>AS<br/><br/>DECLARE @FirstRec int, @LastRec int,@dt varchar(10)<br/><br/>BEGIN<br/><p></p><p>&nbsp; SELECT @FirstRec = (@CurrentPage - 1) * @PageSize<br/>&nbsp; SELECT @LastRec = (@CurrentPage * @PageSize + 1)</p><p>&nbsp; SELECT @dt= substring(convert(varchar,rand()),3,10)<br/>&nbsp; <br/>&nbsp; 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/>&nbsp; EXECUTE (@SqlStr)</p><p>&nbsp; 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/>&nbsp; EXECUTE (@SqlStr)<br/>&nbsp; <br/>&nbsp; SELECT @SqlStr = 'SELECT Count(*) From <a href="mailto:tempdb..Paging'+@dt" target="_blank"><font color="#000000">tempdb..Paging'+@dt</font></a><br/>&nbsp; EXECUTE (@SqlStr)<br/>&nbsp; <br/>&nbsp; SELECT @SqlStr = 'SELECT * FROM <a href="mailto:tempdb..Paging'+@dt+'" target="_blank"><font color="#000000">tempdb..Paging'+@dt+'</font></a> WHERE RID &gt;; '+convert(varchar,@FirstRec)+' and RID &lt; '+convert(varchar,@LastRec)<br/>&nbsp; EXECUTE (@SqlStr)<br/>&nbsp; <br/>&nbsp; SELECT @SqlStr = 'DROP TABLE <a href="mailto:tempdb..Paging'+@dt" target="_blank"><font color="#000000">tempdb..Paging'+@dt</font></a><br/>&nbsp; EXECUTE (@SqlStr) <br/>&nbsp; <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>

kingofse 发表于 2007-4-11 08:50:24

重设rowcount

"set rowcount 100 select EntR'&nbsp;太长了. 重设rowcount=28
页: [1]
查看完整版本: [讨论]分页存储调用出错

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com