Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: getting output of sp_helptext
Date: Mar 24 2002 11:44PM

David J Iannucci writes:
 > I note that sp_helptext returns the text of the procedure in
 > chunks, with newlines artificially attached to each chunk.  I
 > wrote a Perl script to collect these chunks from the output
 > of sp_helptext, "chomp" them, and re-concatenate them together.
 > The result, you'd think, would be identical to what had been
 > put into the database originally.  Apparently not.  In the
 > process of storing the source text, Sybase must be truncating
 > trailing whitespace, or something, from chunks, because after
 > I concatenate, I get words smooshed together with no whitespace
 > in between, viz. "where id = 10" becomes "whereid = 10".

Yes it's a well known problem - it's because sp_helptext doesn't join
the rows from syscomments together correctly. You can use sp__helptext
(from Ed Barlow's stored proc library), pull the proc text from
syscomments directly yourself, or as others have mentioned use to extract the DDL.

Michael Peppler                              Data Migrations, Inc.           *or*
International Sybase User Group: