Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 selectable stored procedures

Author  Topic 

pflarini
Starting Member

3 Posts

Posted - 2008-11-05 : 12:11:37
Hi, in some parts of my application I call a stored procedure and this procedure insert rows in a temporary table, then I read this temp table from dephi to display or use the result.

I need to know if there is a way to select directly from the stored procedure, like : select * from my_procedure(param1, param2)...

thanks,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-05 : 12:15:02
you need to use OPENROWSET for that. see below

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-11-05 : 12:15:16
You might be wanting a table valued function instead. Have a look in books on line.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

pflarini
Starting Member

3 Posts

Posted - 2008-11-05 : 12:29:26
I need something like oracle´s pipelined functions
I don´t make a select in my stored proc, but I return row by row:


http://www.oracle-developer.net/display.php?id=207
Go to Top of Page

pflarini
Starting Member

3 Posts

Posted - 2008-11-05 : 12:33:29
This tabled valued function seams to be the way.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-11-06 : 04:20:51
Just bear in mind that a function cannot modify actual data in any way. (you can't use temp tables inside, though you can use table variables).


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -