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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3931338/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 07:55:45  来源:igfitidea点击:

Sybase IQ - how to show stored procedure without wrapping text?

sqltsqlsybase-iqsybase-asa

提问by FuzzyWuzzy

Using Sybase IQ v12.7. Executing sp_helptext ProcedureNameshows 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?

使用 Sybase IQ v12.7。执行sp_helptext ProcedureName显示存储过程的文本,这很好。但是它以 80 个字符换行。问题是,如何在不换行的情况下显示存储过程的文本文本?

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?

在 Sybase Central Java 版中,有一项功能可以查看存储过程 (Tranact-SQL) 的文本而无需换行。所以这个问题可以用不同的方式重新表述:Sybase Central 如何在不将文本换行为 80 个字符的情况下获取存储过程的文本?

Basically looking for a programmatic way to dump out stored procedures for diff-ing and version control.

基本上是在寻找一种编程方式来转储用于差异和版本控制的存储过程。

Thanks to any responses!

感谢任何回复!

回答by Graeme Perrow

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:

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

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

回答by kolchanov

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/

目前我无法访问 sybase IQ 或 ASA 服务器,但我认为您正在查看来自http://www.edbarlow.com/gem/procs_only/ 的ASE sp__helptext 之类的东西

Try to rewrite this one for ASA server.

尝试为 ASA 服务器重写这个。

Update:

更新:

Look at defncopy utility.

查看 defncopy 实用程序。

回答by B0rG

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.

如果您使用 isql 来执行 sp_helptext,那么您可能没有提供为当前会话设置 column_width 的“-w”参数。尝试对 isql -w999 执行相同的操作,以查看它是否仍然可以换行。

For my own purposes, to compare stored procedures, I use the defncopy utility provided by Sybase, that kolchanov already mentioned.

为了我自己的目的,为了比较存储过程,我使用了 Sybase 提供的 defncopy 实用程序,kolchanov 已经提到过。

回答by vjt

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

如果您没有 defncopy(来自 Sybase 或来自 FreeTDS),您可以使用这个基于 sqsh 和 sed 的脚本:https://gist.github.com/vjt/5920790