still no subroutines in t-sql?

Hi.  We run 2012 std.  I know all the arguments for and against but am wondering if t-sql has introduced the concept of a subroutine yet? 

This would be contained in the sproc but for readability purposes would be "performed" from a complex block of code instead of inline.  It would not be reusable, thus it belongs in a specific proc. 

February 20th, 2015 12:22pm

wondering if t-sql has introduced the concept of a subroutine yet? 


Not sure how you would define a "subroutine" in T-SQL, but as I would define it then we already have it; a CTE = Common Table Expression.; see also Using Common Table Expressions
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2015 12:37pm

thx Olaf.  Not a cte for a number of reasons but mostly because the block of "performed" code is not a query. 
February 20th, 2015 12:49pm

No.  There have been no big changes like that in TSQL.  If you want to reuse a block of procedural TSQL code, then you can put it in a Stored Procedure, a Scalar Function or a Table-Valued Function.

Free Windows Admin Tool Kit Click here and download it now
February 20th, 2015 12:53pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics