Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Trying to parse SQL statements out of a stored procedure

3 posts in General Discussion Last posting was on 2010-10-30 06:22:44.0Z
Mark Pare Posted on 2010-10-25 21:27:05.0Z
Sender: 3723.4cc5f5c9.1804289383@sybase.com
From: Mark Pare
Newsgroups: sybase.public.ase.general
Subject: Trying to parse SQL statements out of a stored procedure
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4cc5f629.372e.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 25 Oct 2010 14:27:05 -0700
X-Trace: forums-1-dub 1288042025 10.22.241.41 (25 Oct 2010 14:27:05 -0700)
X-Original-Trace: 25 Oct 2010 14:27:05 -0700, 10.22.241.41
Lines: 11
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29663
Article PK: 78891

Hi, does anyone know of any code or system stored procedure
that will take a stored procedure and parse out all the
select, insert, update and delete statements?

I am writing code to document our 2000+ stored procedures to
show what tables the final select statement columns are
from.

Let me know. Thanks

Sybase 12.5


ET Posted on 2010-10-26 17:43:23.0Z
From: ET <ET>
Reply-To: ET
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.11) Gecko/20101013 Thunderbird/3.1.5
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: Trying to parse SQL statements out of a stored procedure
References: <4cc5f629.372e.1681692777@sybase.com>
In-Reply-To: <4cc5f629.372e.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4cc7133b@forums-1-dub>
Date: 26 Oct 2010 10:43:23 -0700
X-Trace: forums-1-dub 1288115003 10.22.241.152 (26 Oct 2010 10:43:23 -0700)
X-Original-Trace: 26 Oct 2010 10:43:23 -0700, vip152.sybase.com
Lines: 22
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29664
Article PK: 78892

Hi,

I think with defncopy and some tail/grep/awk you can achieve this but
what kind of output do you want ?

Do you only want the last select or all the DML statements from all your
SPs ?

Emmanuel

Le 25/10/2010 23:27, Mark Pare a écrit :

> Hi, does anyone know of any code or system stored procedure
> that will take a stored procedure and parse out all the
> select, insert, update and delete statements?
>
> I am writing code to document our 2000+ stored procedures to
> show what tables the final select statement columns are
> from.
>
> Let me know. Thanks
>
> Sybase 12.5


Michael Peppler [Team Sybase] Posted on 2010-10-30 06:22:44.0Z
From: "Michael Peppler [Team Sybase]" <mpeppler@peppler.org>
Organization: Peppler Consulting SARL
Subject: Re: Trying to parse SQL statements out of a stored procedure
User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
Message-ID: <pan.2010.10.30.06.22.43.168286@peppler.org>
Newsgroups: sybase.public.ase.general
References: <4cc5f629.372e.1681692777@sybase.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 29 Oct 2010 23:22:44 -0700
X-Trace: forums-1-dub 1288419764 10.22.241.152 (29 Oct 2010 23:22:44 -0700)
X-Original-Trace: 29 Oct 2010 23:22:44 -0700, vip152.sybase.com
Lines: 19
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29678
Article PK: 78906


On Mon, 25 Oct 2010 14:27:05 -0700, wrote:

> Hi, does anyone know of any code or system stored procedure
> that will take a stored procedure and parse out all the
> select, insert, update and delete statements?
>
> I am writing code to document our 2000+ stored procedures to
> show what tables the final select statement columns are
> from.

Take a look at SQLBrowser (www.sqlbrowser.com). It's not free, but it will
do exactly what you need: parse all of procs/triggers/views in one
or more databases, and produce a complete html based view of the objects
with all the dependencies and hyperlinks between the objects.

I use it everyday - and it is invaluable if you have a large code base...

Michael