0

I am trying to rewrite a stored procedure to a natively compiled stored procedure. The procedure refers to 4 tables; these tables are normal tables (non memory-optimized) and I am using 2 views related to it.

Is it possible to create a natively compiled stored procedure without converting any of these objects to memory-optimized tables?

4
  • 1
    Is there a question? Commented Nov 15, 2018 at 22:57
  • Ok, I'll do my best Commented Nov 15, 2018 at 23:12
  • I am trying to rewrite a stored procedure to Natively compiled stored procedure. The procedure refers to 4 tables, these tables are normal tables (non memory optimised) and I am using 2 views related to it. Is it possible to create a Natively Compiled stored procedure without converting any of these objects to Memory optimised tables? Commented Nov 15, 2018 at 23:16
  • @Lucas, when adding details that affect the question, please edit the question rather than leaving a comment. Comments can be ephemeral. Commented Nov 15, 2018 at 23:53

1 Answer 1

3

No, natively compiled stored procedures cannot reference disk-based tables, only memory-optimized ones. Here is a quote from Kalen Delaney's book SQL Server Internals: In-Memory OLTP:

However, there are limitations on the T-SQL language constructs that are allowed inside a natively compiled stored procedure, compared to the rich feature set available with interpreted code. In addition, natively compiled stored procedures can only access memory-optimized tables and cannot reference disk-based tables.

I could not find clear statement in the official Microsoft Docs for that, except this limitation, which is direct consequence of the fact, that natively compiled stored procedures can't reference "normal" tables:

For memory-optimized tables, FOREIGN KEY constraints are only supported for foreign keys referencing primary keys of other memory-optimized tables.

Sign up to request clarification or add additional context in comments.

3 Comments

Well, the FROM clause limits specified here is also a pretty big clue.
Yep, absolutely! :) Thanks for the clarification!
@AndreyNikolov Thanks for the reply :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.