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.

Stored Procedure Father

6 posts in General Discussion Last posting was on 2010-02-19 15:09:06.0Z
RGS Posted on 2010-02-16 02:30:56.0Z
Sender: 233f.4b7a0228.1804289383@sybase.com
From: RGS
Newsgroups: sybase.public.ase.general
Subject: Stored Procedure Father
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b7a0360.2381.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 15 Feb 2010 18:30:56 -0800
X-Trace: forums-1-dub 1266287456 10.22.241.41 (15 Feb 2010 18:30:56 -0800)
X-Original-Trace: 15 Feb 2010 18:30:56 -0800, 10.22.241.41
Lines: 17
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28965
Article PK: 78206

Inside a stored procedure I need to know what is the name of
the stored procedure "father" (the stored procedure who
invokes my program) and PRINT this id

For example:

sp1
...
exec sp2
...

Inside of sp2 I need to print the id of sp father e.d. sp1

Do I have a method or global varible to show this?


Thanks a lot,


"Mark A. Parsons" <iron_horse Posted on 2010-02-16 09:16:05.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: Stored Procedure Father
References: <4b7a0360.2381.1681692777@sybase.com>
In-Reply-To: <4b7a0360.2381.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 100126-1, 01/26/2010), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b7a6255$1@forums-1-dub>
Date: 16 Feb 2010 01:16:05 -0800
X-Trace: forums-1-dub 1266311765 10.22.241.152 (16 Feb 2010 01:16:05 -0800)
X-Original-Trace: 16 Feb 2010 01:16:05 -0800, vip152.sybase.com
Lines: 21
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28966
Article PK: 78208

Assuming you have the MDA tables installed in your dataserver and your login has been granted the mon_role role, you may
be able to obtain the desired info from the master..monProcessProcedures table.

RGS wrote:
> Inside a stored procedure I need to know what is the name of
> the stored procedure "father" (the stored procedure who
> invokes my program) and PRINT this id
>
> For example:
>
> sp1
> ...
> exec sp2
> ...
>
> Inside of sp2 I need to print the id of sp father e.d. sp1
>
> Do I have a method or global varible to show this?
>
>
> Thanks a lot,


"Mark A. Parsons" <iron_horse Posted on 2010-02-17 02:07:48.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: Stored Procedure Father
References: <4b7a6255$1@forums-1-dub> <4b7aa28e.3a75.1681692777@sybase.com>
In-Reply-To: <4b7aa28e.3a75.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 100126-1, 01/26/2010), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b7b4f74$1@forums-1-dub>
Date: 16 Feb 2010 18:07:48 -0800
X-Trace: forums-1-dub 1266372468 10.22.241.152 (16 Feb 2010 18:07:48 -0800)
X-Original-Trace: 16 Feb 2010 18:07:48 -0800, vip152.sybase.com
Lines: 35
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28969
Article PK: 78209

Well, I just pointed you at a possible source for the info ... you still need to do a bit of coding and testing. ;-)

There's also the question of whether or not monProcessProcedures will actually work for you ... and that'll depend on
your version of ASE. In earlier MDA table implementations the ContextID column wasn't reliable. Recent versions (eg,
ASE 15.0.3) seem to do a better job of keeping the ContextID column updated properly.

RGS wrote:
> Thanks a lot, you are a real EXPERT in ASE
>
>
>> Assuming you have the MDA tables installed in your
>> dataserver and your login has been granted the mon_role
>> role, you may be able to obtain the desired info from the
>> master..monProcessProcedures table.
>>
>> RGS wrote:
>>> Inside a stored procedure I need to know what is the
>>> name of the stored procedure "father" (the stored
>>> procedure who invokes my program) and PRINT this id
>>>
>>> For example:
>>>
>>> sp1
>>> ...
>>> exec sp2
>>> ...
>>>
>>> Inside of sp2 I need to print the id of sp father e.d.
>>> sp1
>>> Do I have a method or global varible to show this?
>>>
>>>
>>> Thanks a lot,


RGS Posted on 2010-02-19 15:09:06.0Z
Sender: 233f.4b7a0228.1804289383@sybase.com
From: RGS
Newsgroups: sybase.public.ase.general
Subject: Re: Stored Procedure Father
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b7ea992.63dd.1681692777@sybase.com>
References: <4b7b4f74$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 19 Feb 2010 07:09:06 -0800
X-Trace: forums-1-dub 1266592146 10.22.241.41 (19 Feb 2010 07:09:06 -0800)
X-Original-Trace: 19 Feb 2010 07:09:06 -0800, 10.22.241.41
Lines: 44
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28982
Article PK: 78220

Really I am using ASE 15.0.3 then I think this will be work
very well!!!

> Well, I just pointed you at a possible source for the info
> ... you still need to do a bit of coding and testing. ;-)
>
> There's also the question of whether or not
> monProcessProcedures will actually work for you ... and
> that'll depend on your version of ASE. In earlier MDA
> table implementations the ContextID column wasn't
> reliable. Recent versions (eg, ASE 15.0.3) seem to do a
> better job of keeping the ContextID column updated
> properly.
>
>
>
> RGS wrote:
> > Thanks a lot, you are a real EXPERT in ASE
> >
> >
> >> Assuming you have the MDA tables installed in your
> >> dataserver and your login has been granted the mon_role
> >> role, you may be able to obtain the desired info from
> the >> master..monProcessProcedures table.
> >>
> >> RGS wrote:
> >>> Inside a stored procedure I need to know what is the
> >>> name of the stored procedure "father" (the stored
> >>> procedure who invokes my program) and PRINT this id
> >>>
> >>> For example:
> >>>
> >>> sp1
> >>> ...
> >>> exec sp2
> >>> ...
> >>>
> >>> Inside of sp2 I need to print the id of sp father e.d.
> >>> sp1
> >>> Do I have a method or global varible to show this?
> >>>
> >>>
> >>> Thanks a lot,


Sherlock, Kevin [TeamSybase] Posted on 2010-02-16 21:03:06.0Z
From: "Sherlock, Kevin [TeamSybase]" <kevin.sherlock@teamsybase.com>
Newsgroups: sybase.public.ase.general
References: <4b7a0360.2381.1681692777@sybase.com>
Subject: Re: Stored Procedure Father
Lines: 49
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b7b080a$1@forums-1-dub>
Date: 16 Feb 2010 13:03:06 -0800
X-Trace: forums-1-dub 1266354186 10.22.241.152 (16 Feb 2010 13:03:06 -0800)
X-Original-Trace: 16 Feb 2010 13:03:06 -0800, vip152.sybase.com
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28968
Article PK: 78211

1> sp_showtext darth_vader
2> go

create proc darth_vader
as
declare @fatherid int
select @fatherid = @@procid
exec luke "I am your father!",@fatherid

1> sp_showtext luke
2> go
create proc luke(@msgtext varchar(30),@fatherid int)
as
declare @myname varchar(30)
,@resulttext varchar(200)
select @myname = object_name(@@procid)

select @resulttext = @myname + ", " + @msgtext + " - " +
object_name(@fatherid)
select @resulttext

1> exec darth_vader
2> go
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------

luke, I am your father! - darth_vader

<RGS> wrote in message news:4b7a0360.2381.1681692777@sybase.com...
> Inside a stored procedure I need to know what is the name of
> the stored procedure "father" (the stored procedure who
> invokes my program) and PRINT this id
>
> For example:
>
> sp1
> ...
> exec sp2
> ...
>
> Inside of sp2 I need to print the id of sp father e.d. sp1
>
> Do I have a method or global varible to show this?
>
>
> Thanks a lot,