Sybase IQ - 如何在不换行的情况下显示存储过程?
使用 Sybase IQ v12.7。执行 sp_helptext procedureName
显示存储过程的文本,这很好。但是它会以 80 个字符换行。问题是,如何在不换行的情况下显示存储过程的文本文本?
在 Sybase Central Java 版中,有一项功能可以查看存储过程 (Tranact-SQL) 的文本,无需换行。因此,问题可以用不同的方式重述:Sybase Central 如何获取存储过程的文本而不将文本换行为 80 个字符?
基本上寻找一种编程方式来转储存储过程以进行比较和版本控制。
感谢任何回复!
Using Sybase IQ v12.7. Executing sp_helptext ProcedureName
shows the text of the stored procedure which is fine. However it wraps lines at 80 characters. The question is, how to show text text of a stored procedure without wrapping?
In Sybase Central Java Edition there is a feature see the text of a stored procedure (Tranact-SQL) without line wrapping. So the question could be restated in a different way: how does Sybase Central get the text of a stored procedure without wrapping the text at 80 characters?
Basically looking for a programmatic way to dump out stored procedures for diff-ing and version control.
Thanks to any responses!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
sp_helptext 不进行任何换行 - 它在换行符处分解过程定义文本并将每一行作为一行返回。如果您希望将整个内容作为单个字符串返回,您可以直接从系统表中选择过程定义:
sp_helptext does not do any wrapping - it breaks up the procedure definition text at the newline characters and returns each line as a row. If you want the whole thing returned as a single string, you can select the procedure definition directly from the system table:
目前我无法访问 sybase IQ 或 ASA 服务器,但我认为您正在寻找类似于 http 的 ASE sp__helptext ://www.edbarlow.com/gem/procs_only/
尝试为 ASA 服务器重写这个。
更新:
查看 defncopy 实用程序。
Currently I have not access to sybase IQ or ASA server, but I think you are looking something like ASE sp__helptext from http://www.edbarlow.com/gem/procs_only/
Try to rewrite this one for ASA server.
Update:
Look at defncopy utility.
如果您使用 isql 执行 sp_helptext,那么您可能没有提供为当前会话设置 column_width 的“-w”参数。尝试对 isql -w999 执行相同的操作,看看它是否仍然换行。
为了我自己的目的,为了比较存储过程,我使用 Sybase 提供的 defncopy 实用程序,kolchanov 已经提到过。
If you are using isql to execute the sp_helptext, then probbably you did not supply the "-w" parameter which sets column_width for current session. Try to do the same with isql -w999 to see if it still wraps.
For my own purposes, to compare stored procedures, I use the defncopy utility provided by Sybase, that kolchanov already mentioned.
如果您没有 defncopy(来自 Sybase 或来自 FreeTDS),您可以使用这个基于 sqsh 和 sed 的脚本: https://gist.github.com/vjt/5920790
If you don't have defncopy (either from Sybase or from FreeTDS) you can use this sqsh and sed-based script: https://gist.github.com/vjt/5920790