Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As a programming paradigm it is ugly because it involves passing out-of-band parameters ('context parameters') that are not explicitly called out in the procedure signatures. This creates hidden dependencies and leads to spaghetti effect.</p> <p>But in the specific context of SQL, there is simply <strong>no alternative</strong>. SQL works with data sets and you cannot pass back and forth these data sets as procedure parameters. You have few alternatives:</p> <ul> <li>Pass through the client. All too obvious not a real option.</li> <li>XML or strings with delimiters types to represent results. Not a serious option by any stretch, they may give good 'programming' semantics (ie. <a href="http://en.wikipedia.org/wiki/Law_of_Demeter" rel="nofollow noreferrer">Demeter Law</a> conformance) but they really really suck when performance comes into play.</li> <li>shared tables (be it in tempdb or in appdb) like Raj suggest. You're loosing the #temp automated maintenance (cleanup on ref count goes to 0) and you have to be prepared for creation race conditions. Also they can grow large for no reason (they're no longer partitioned by session into separate rowsets, like #temp tables are).</li> <li>@tables. They're scoped to the declaration context (ie. the procedure) and cannot be passed back and forth between procedures. I also discovered <a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=467035" rel="nofollow noreferrer">some nasty problems under memory pressure</a>.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload