Can I use a stored procedure as table inside a stored procedure?
for eg. i have a stored procedure named QMENU and QNEWMENU
I want to use these two stored procedures in another stored procedure like:
CREATE PROCEDURE MENU(@roll1 as INT)
AS
BEGIN
SELECT * FROM QMENU;
UNION ALL;
SELECT * FROM QNEWMENU;
END
Thnx in advance,
Olaf Pietsch - 15 May 2008 18:15 GMT
> Can I use a stored procedure as table inside a stored procedure?
> for eg. i have a stored procedure named QMENU and QNEWMENU
[quoted text clipped - 8 lines]
> SELECT * FROM QNEWMENU;
> END
No, it is not possible to use SP in this way.
But you can use a User Defined Function (UDF) instead which return a table.
Table-Valued Functions
http://www.sqlteam.com/article/intro-to-user-defined-functions-updated
SQL Server 2005 Books Online
CREATE FUNCTION (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms186755.aspx

Signature
Gruß Olaf
Ich unterstütze PASS Deutschland e.V. (http://www.sqlpass.de)
Blog (http://www.sqlpass.de/PASSUserBlogs/tabid/178/Default.aspx?BlogID=3)
Regionalgruppe Köln/Bonn/Düsseldorf
(http://www.sqlpass.de/Regionalgruppen/KoelnBonnDuesseldorf/tabid/81/Default.aspx)
keyur joshi - 17 May 2008 13:24 GMT
> Can I use a stored procedure as table inside a stored procedure?
> for eg. i have a stored procedure named QMENU and QNEWMENU
[quoted text clipped - 9 lines]
>
> Thnx in advance,
keyur joshi - 17 May 2008 13:25 GMT
Can I use a stored procedure as table inside a stored procedure?
> for eg. i have a stored procedure named QMENU and QNEWMENU
> I want to use these two stored procedures in another stored procedure like:
[quoted text clipped - 8 lines]
>
> Thnx in advance,