Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difference between a macro and a stored procedure? 1

Status
Not open for further replies.

CapsuleCorpJX

IS-IT--Management
Jun 23, 2004
70
US
Is there anything a stored procedure can do that a macro can't?
 
- define and set variables
- IF/THEN/ELSE
- loop using WHILE/REPEAT
- dynamic SQL
- cursors
- error handling

Dieter
 
I have a question here regarding the macro and SP.

I know that a macro can reference a global temporary table and volatile table.

Can a stored proc also do that? If not, then that will also be a difference between the two.
 
Of course it can.

But there's one thing only a macro can do:
return answer sets

To do that within a SP you have to insert/select the data into a global temp table and after CALLing the SP select from that table.

Dieter
 
Another way by which your stored procedure can return an ouput is using a cursor. Cursors are used only for multiple row outputs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top