Introduction
The Natively Compiled Stored Procedure is Introduced in SQL Server 2014. They are compiled when they are created. Native compilation allows for faster and more efficient data access than interpreted or traditional or disk based Transact-SQL.
A Natively Compiled Stored Procedure does not support all T-SQL programmability. There are many features, functions and keywords that are not available in a natively compiled Stored Procedure.
Features not available with Natively Compiled Stored Procedures
| Feature | Remark or alternative approach |
| Cursors | Cursors are not supported in natively compiled Stored Procedures. Alternatively we can use a WHILE loop instead of Cursors |
| Sub query | Sub queries are not supported.
We can use a join instead of a sub query if possible. |
| SELECT INTO | INTO Clause is not supported with a SELECT keyword.
Alternatively we can use INSERT INTO [TableName] SELECT. Example: SELECT Id, Name into table2 from table1 – Not supported INSERT INTO table2 SELECT Id, Name from Table1 Note: In an INSERT statement, values must be specified for all columns. |
| CLR Store procedure | A CLR Stored Procedure cannot be natively compiled. |
| CTE (common table Expression) | Common Table Expressions are not supported in natively compiled Stored Procedures. |
| MARS | Multiple Active Result Set is not supported with natively compiled Stored Procedures. |
| Linked servers | Linked servers are not supported with natively compiled Stored Procedure. |
| Temporary table | Temporary table cannot be used in natively compiled Stored Procedures. Instead of a temporary table we can use a memory-optimized table with DURABILITY=SCHEMA_ONLY. |
| DTC | Natively compiled Stored Procedures and memory-optimized tables cannot be accessed from distributed transactions. |
| OUTER JOIN | OUTER JOIN is not supported with a natively compiled Stored Procedure. |
| PIVOT / UNPIVOT | PIVOT / UNPIVOT is not supported with a natively compiled Stored Procedure. |
| APPLY | The operator APPLY is not supported with a natively compiled Stored Procedure. |
| Disk-based tables | |
| Views | |
| DELETE / UPDATE with FROM clause | A DELETE / UPDATE statement is not supported with a FROM clause with natively compiled Stored Procedures. |
| Isolation Level | READ UNCOMMITTED isolation level is not supported with natively compiled Stored Procedures. |
| Sequences | Sequences cannot be used inside natively compiled Stored Procedures. |
| HASH / MERGE | HASH / MERGE joins are not supported. |
Keywords not available with Natively Compiled Store Procedures

Join the conversation! Your thoughts help the community grow.