title: is sharing temp tables across procedures considered bad form?
body: <p>I have 2 procedures. One that builds a temp table and another (or several others) that use a temp table that's created in the first proc. Is this considered bad form? I'm walking into an existing codebase here and it uses this pattern a lot. It certainly bothers me but I can't say that it's explicitly a bad idea. I just find it to be an annoying pattern -- something smells rotten but I can't say what. I'd prefer to build the table locally and then fill it with an exec. But that requires procs that only return one table, which is unusual in the existing codebase. </p>
  
  <p>Do the gurus of SQL shy away from this sort of temp table sharing? If so, why? I'm trying to form a considered opinion about this and would like some input. </p>
  
  <p>Would a view be a viable alternative? </p>
  
  <p>What about performance? Would it be better to build a @table locally or build a #table in the "fill" proc? </p>
  
  <p>There's a good discussion of all methods here: <a href="http://www.sommarskog.se/share_data.html" rel="nofollow noreferrer">http://www.sommarskog.se/share_data.html</a></p>