Export (0) Print
Expand All

EXECUTE (Azure SQL Database)

This topic is OBSOLETE. You can find the most current version in the SQL 14 Transact-SQL Reference.

ImportantImportant
This topic is not maintained. For the current version, see EXECUTE (Transact-SQL).

Executes a command string or character string within a Transact-SQL batch, or one of the following modules: system stored procedure, user-defined stored procedure, scalar-valued user-defined function, or extended stored procedure. 

Syntax Conventions (Azure SQL Database)

Execute a stored procedure or function
[ { EXEC | EXECUTE } ]
    { 
      [ @return_status= ]
      { module_name  | @module_name_var } 
        [ [ @parameter= ] { value 
                           | @variable [ OUTPUT ] 
                           | [ DEFAULT ] 
                           }
        ]
      [ ,...n ]
      [ WITH RECOMPILE ]
    }
[;]

Execute a character string
{ EXEC | EXECUTE } 
    ( { @string_variable | [ N ]'tsql_string' } [ + ...n ] )
    [ AS {  USER } ='name' ]
[;]

<execute_option>::=
{
        RECOMPILE 
    | { RESULT SETS UNDEFINED } 
    | { RESULT SETS NONE } 
    | { RESULT SETS ( <result_sets_definition> [,...n ] ) }
} 

<result_sets_definition> ::= 
{
    (
         { column_name 
           data_type 
         [ COLLATE collation_name ] 
         [ NULL | NOT NULL ] }
         [,...n ]
    )
    | AS OBJECT 
        [ db_name . [ schema_name ] . | schema_name . ] 
        {table_name | view_name | table_valued_function_name }
    | AS TYPE [ schema_name.]table_type_name
    | AS FOR XML 

This syntax diagram demonstrates the supported arguments and options in Microsoft Microsoft Azure SQL Database.

The EXECUTE statement can now specify the metadata returned from the statement by using the WITH RESULT SETS argument. For more information, see EXECUTE (Transact-SQL).

Microsoft Azure SQL Database does not support the following arguments and options when using the EXECUTE statement:

  • Number option

  • EXECUTE AS LOGIN

  • Execute a pass-through command against a linked server

Community Additions

Show:
© 2014 Microsoft