Sybase IQ - 如何在不换行的情况下显示存储过程?

发布于 2024-09-27 21:43:02 字数 306 浏览 2 评论 0原文

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦幻的心爱 2024-10-04 21:43:02

sp_helptext 不进行任何换行 - 它在换行符处分解过程定义文本并将每一行作为一行返回。如果您希望将整个内容作为单个字符串返回,您可以直接从系统表中选择过程定义:

select proc_defn from SYS.SYSPROCEDURE where proc_name='<procedurename>'

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:

select proc_defn from SYS.SYSPROCEDURE where proc_name='<procedurename>'
寄居者 2024-10-04 21:43:02

目前我无法访问 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.

恋竹姑娘 2024-10-04 21:43:02

如果您使用 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.

南城旧梦 2024-10-04 21:43:02

如果您没有 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文