SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Can a CURSOR be populated by firing a stored procedure?


Can a CURSOR be populated by firing a stored procedure?

Author
Message
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)

Group: General Forum Members
Points: 98696 Visits: 38996
Eugene Elutin (5/9/2013)
Lynn Pettis (5/9/2013)
Eugene Elutin (5/9/2013)
Lynn Pettis (5/8/2013)
Eugene Elutin (5/8/2013)
Actually you can, if you really want or need to!
You should use cursor datatype in output parameter of your procedure. Here you will find a sample:

http://msdn.microsoft.com/en-GB/library/ms175498(v=sql.105).aspx

Should, also mention that this technique is not used very often...


Unless you are working with Oracle, then reference cursors are the only way to return data from a stored procedure.
;-)


Sorry, what do you mean by that?
I know at least four ways of returning result(s) (data) from stored procedure in T-SQL.


Yes, T-SQL is nice in that way. I had the opportunity to work with Oracle for a year, and the methods we can use in T-SQL (MS SQL Server) don't work in Oracle. You use reference cursors to return data, which you can also use in T-SQL by returning a cursor as an outout parameter.



I'm not an Oracle expert, but I remember that it has few ways of getting back data too. Have you used pipelined functions?



Nope and where I work now I don't have to worry about writing PL/SQL either. I like T-SQL, it just seems right.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search