Shared Temp tables Vs Temp tables as I/O parameter

davidvilla

Member
Hi all,
Which is advantageous? A temp-table shared between two procedures or passing the temp-table as a I/O parameter between these procedures. It would be helpful, if I also get the reason for the same.

Thanks in advance.
 
Using shared anything is bad practise. That's generally accepted. You should always use parameters to pass stuff around.
 
You are missing the third option ... encapsulate the TT in an object or procedure and provide methods to manipulate it. That is the best alternative since you then aren't flinging the TT all over the place. Absent that, absolutely go with the parameter over shared because it makes the relationship clear. With shared, one is never quite clear who is doing what.
 
Back
Top