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

FuzzyWuzzy picture FuzzyWuzzy · Oct 14, 2010 · Viewed 40.2k times · Source

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!

Answer

Graeme Perrow picture Graeme Perrow · Oct 15, 2010

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>'