Getting Started with Adobe After Effects - Part 6: Motion Blur
A collection of quick technology learning tips from what people around you learn every day

EXEC can be nested and can return any number of resultsets

Jun 14 2011 8:01AM by Madhivanan   

Execute this to understand how you can nest EXEC

EXEC('EXEC(''EXEC(''''EXEC(''''''''select 1 as number select * from sysobjects'''''''')'''')'')')
Read More..   [32134 clicks]

Published under: SQL Server Tips ·  ·  ·  · 


Madhivanan
3 · 40% · 12958
4
 
1
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten



Submit

5  Comments  

  • Never tried this, but was fun learning this tip.

    commented on Jun 14 2011 10:25AM
    Jacob Sebastian
    1 · 100% · 32235
  • I wouldn't exactly call that nesting EXEC. This is really just wrapping dynamic SQL...

    Now what would be really useful would be if you could put those two result sets into two separate tables. Or if you could do things like this:

    IF EXISTS (EXEC SPName) ...
    

    or

    SELECT
    FROM
       Table T
       OUTER APPLY (EXEC SPName T.Value) X
    
    commented on Jun 14 2011 11:32AM
    ErikEckhardt
    65 · 3% · 898
  • Wow, great trick...Both styles seems to be great.

    commented on Jun 15 2011 4:45AM
    Robert Dennyson
    11 · 14% · 4430
  • @Madhivanan, the problem with that is that in SQL Server 2005 and up, the server has to have the surface area configuration changed to allow ad-hoc distributed queries. The queries also have to be converted to dynamic SQL (and if you're doing that you could use temp tables anyway). Last of all, I think you can run into permission and permission chaining problems when using loopback queries.

    commented on Jun 15 2011 11:46AM
    ErikEckhardt
    65 · 3% · 898

Your Comment


Sign Up or Login to post a comment.

"EXEC can be nested and can return any number of resultsets" rated 5 out of 5 by 4 readers
EXEC can be nested and can return any number of resultsets , 5.0 out of 5 based on 4 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]