Thursday, August 23, 2012

T-SQL Syntax

Recently I have came across very good question on
Different T-SQL constructs can assign a value to a regular identifier with a leading '@' without using SET nor SELECT :
  1. An Input argument to a Procedure or Function -
  2. An Output argument to a Procedure -
  3. EXECUTE a Function: EXEC @return = udfFunct() -
  4. The Stored Procedure return status: EXEC @status = uspProc (This is very different from a Function return.) -
  5. The OUTPUT clause: OUTPUT INTO @tablevar (Could count this 4 times but it is really one construct)
  6. RECEIVE .... FROM INTO @tablevar -
  7. FETCH NEXT FROM cursor INTO @varname -
  8. DECLARE @varname INT = 0; -

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.