Named procedure parameters
Emulation context
In SQL Server, stored procedures can be invoked using named parameters, for example:
This improves readability, allows reordering of arguments, and reduces the risk of positional mismatches.
However, Microsoft Fabric Warehouse does not support named parameters in procedure calls. Instead, it requires strictly positional arguments, for example:
This difference creates an important compatibility gap:
SQL Server procedures can rely on the caller using named arguments, allowing the definition and call order to differ.
Fabric Warehouse mandates that procedure calls match the exact declared parameter order.
This mismatch affects any migrated scripts, applications, or orchestration tools that depend on the flexibility of named parameters.
Emulation strategy
SQL Tran addresses this by transforming named EXEC
calls into positional EXEC
calls by:
Analyzing the stored procedure signature to determine the declared parameter order.
Rewriting any named parameter calls into positional calls, placing each argument in the correct slot. Even if the original SQL call provided parameters out of order using names, the translated Fabric call aligns the arguments correctly by position.
Inserting explicit
NULL
for any omitted optional parameters to maintain positional integrity.Adding
SET
statements usingISNULL
inside the target procedure body to apply declared default values at runtime.Including
/* SQLTRAN FIX */
comments alongside the transformed calls to show the original named expressions for traceability.
This automatic transformation enables most standard EXEC
calls to continue functioning correctly in Fabric Warehouse without manual rewrites.
Code example
SQL Server:
Fabric Warehouse (generated by SQL Tran):
Important notes
Procedure signature dependency: The translation relies on having access to the procedure definition to resolve parameter order. Missing or outdated metadata can result in incorrect rewrites.
Explicit
NULL
handling: When an optional parameter is omitted, SQL Tran insertsNULL
into the positional call, even if the procedure defines another default. The translated procedure applies the declared defaults usingSET
andISNULL
.Dynamic
EXEC
exclusion: Dynamically constructedEXEC
statements (via strings, variables, orsp_executesql
) are not transformed by SQL Tran and require manual handling.Manual validation recommended: For dynamic, indirect, or complex procedures, human review is essential to ensure that the translation aligns with the intended semantics and preserves default behaviors.
Last updated