|
Home > Archive > SQL Anywhere database > October 2005 > Using the results of a stored procedure in another stored procedure
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using the results of a stored procedure in another stored procedure
|
|
| Steve Pasha 2005-10-27, 7:41 am |
| Hi,
I have several stored procedures that are relatively
complicated. I want to use those procedures in others.
Microsoft SqlServer allows you to execute this type of
command:
INSERT INTO #test
EXEC spS_complex_procedur
e
It inserts the results of the stored procedure in the #test
table. That way, spS_complex_procedur
e can be used in
multiple stored procedures. Is there something comparable
in iAnywhere to accomplish this? I don't want to have to
incorporate the code from spS_complex_procedur
e everywhere.
Thanks,
Steve
| |
| Glenn Paulley 2005-10-27, 7:41 am |
| If you are using SQL Anywhere 9.x, you can use the results of a procedure
in the FROM clause of a dml statement as if it was a table. Your
statement below would be
INSERT INTO #test
SELECT * FROM spS_complex_procedur
e()
You can alias the procedure name with a correlation name (just like a
table), and you can alter the names of the result attributes of the
procedure, and their domains, by using a WITH clause modifier. See the
help.
Glenn
Steve Pasha wrote in news:435f4462.5621.1681692777@sybase.com:
> Hi,
>
> I have several stored procedures that are relatively
> complicated. I want to use those procedures in others.
> Microsoft SqlServer allows you to execute this type of
> command:
>
> INSERT INTO #test
> EXEC spS_complex_procedur
e
>
> It inserts the results of the stored procedure in the #test
> table. That way, spS_complex_procedur
e can be used in
> multiple stored procedures. Is there something comparable
> in iAnywhere to accomplish this? I don't want to have to
> incorporate the code from spS_complex_procedur
e everywhere.
>
> Thanks,
> Steve
>
--
Glenn Paulley
Research and Development Manager, Query Processing
iAnywhere Solutions Engineering
EBF's and Patches: http://downloads.sybase.com
choose SQL Anywhere Studio >> change 'time frame' to all
To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm
SQL Anywhere Studio Supported Platforms and Support Status
http://my.sybase.com/detail?id=1002288
|
|
|
|
|