{"id":663,"date":"2023-11-22T00:41:48","date_gmt":"2023-11-22T00:41:48","guid":{"rendered":"https:\/\/test.samplewebsitelink.com\/ordba\/?p=663"},"modified":"2023-11-22T00:41:50","modified_gmt":"2023-11-22T00:41:50","slug":"creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure","status":"publish","type":"post","link":"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/","title":{"rendered":"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>03\/16\/2017<\/li>\n\n\n\n<li>5 minutes to read<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Applies to:<\/strong>&nbsp;SQL Server (all supported versions)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This topic contains a sample that introduces you to the syntax for In-Memory OLTP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To enable an application to use In-Memory OLTP, you need to complete the following tasks:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a memory-optimized data filegroup and add a container to the filegroup.<\/li>\n\n\n\n<li>Create memory-optimized tables and indexes. For more information, see&nbsp;CREATE TABLE (Transact-SQL).<\/li>\n\n\n\n<li>Load data into the memory-optimized table and update statistics after loading the data and before creating the compiled stored procedures. For more information, see&nbsp;Statistics for Memory-Optimized Tables.<\/li>\n\n\n\n<li>Create natively compiled stored procedures to access data in memory-optimized tables. For more information, see&nbsp;CREATE PROCEDURE (Transact-SQL). You can also use a traditional, interpreted Transact-SQL to access data in memory-optimized tables.<\/li>\n\n\n\n<li>As needed, migrate data from existing tables to memory-optimized tables.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/ordba.net\/assets\/images\/creating-memory-optimized-table.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Background on In-Memory objects<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For information on how to use SQL Server Management Studio to create memory-optimized tables, see&nbsp;SQL Server Management Studio Support for In-Memory OLTP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Natively compiled stored procedures<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Natively compiled stored procedures are Transact-SQL stored procedures compiled to native code, and that access memory-optimized tables. Natively compiled stored procedures allow for efficient execution of the queries and business logic in the stored procedure. For more details about the native compilation process, see&nbsp;Native Compilation of Tables and Stored Procedures. For more information about migrating disk-based stored procedures to natively compiled stored procedures, see&nbsp;Migration Issues for Natively Compiled Stored Procedures.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&nbsp;Note<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One difference between interpreted (disk-based) stored procedures and natively compiled stored procedures is that an interpreted stored procedure is compiled at first execution, whereas a natively compiled stored procedure is compiled when it is created. With natively compiled stored procedures, many error conditions can be detected at create time and will cause creation of the natively compiled stored procedure to fail (such as arithmetic overflow, type conversion, and some divide-by-zero conditions). With interpreted stored procedures, these error conditions typically do not cause a failure when the stored procedure is created, but all executions will fail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Link to PDF :&nbsp;<a href=\"https:\/\/ordba.net\/pdf\/Creating-a-Memory-Optimized%20Table-and-a-Natively-Compiled-Stored-Procedure.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">&nbsp;Diagnose and resolve latch contention on SQL Server<\/a><\/strong>&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure Applies to:&nbsp;SQL Server (all supported versions) This topic contains a sample that introduces you to the syntax for In-Memory OLTP. To enable an application to use In-Memory OLTP, you need to complete the following tasks: Background on In-Memory objects For information on how to use &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/\"> <span class=\"screen-reader-text\">Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":664,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[11],"tags":[],"class_list":["post-663","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure - Ordba<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure - Ordba\" \/>\n<meta property=\"og:description\" content=\"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure Applies to:&nbsp;SQL Server (all supported versions) This topic contains a sample that introduces you to the syntax for In-Memory OLTP. To enable an application to use In-Memory OLTP, you need to complete the following tasks: Background on In-Memory objects For information on how to use &hellip; Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/\" \/>\n<meta property=\"og:site_name\" content=\"Ordba\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-22T00:41:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-22T00:41:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/test.samplewebsitelink.com\/ordba\/wp-content\/uploads\/2023\/11\/creating-memory-optimized-table.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"539\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"ordba\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ordba\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/\",\"url\":\"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/\",\"name\":\"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure - Ordba\",\"isPartOf\":{\"@id\":\"https:\/\/test.samplewebsitelink.com\/ordba\/#website\"},\"datePublished\":\"2023-11-22T00:41:48+00:00\",\"dateModified\":\"2023-11-22T00:41:50+00:00\",\"author\":{\"@id\":\"https:\/\/test.samplewebsitelink.com\/ordba\/#\/schema\/person\/7365beabb32b7aa77cf0e890ee90ea0f\"},\"breadcrumb\":{\"@id\":\"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/test.samplewebsitelink.com\/ordba\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/test.samplewebsitelink.com\/ordba\/#website\",\"url\":\"https:\/\/test.samplewebsitelink.com\/ordba\/\",\"name\":\"Ordba\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/test.samplewebsitelink.com\/ordba\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/test.samplewebsitelink.com\/ordba\/#\/schema\/person\/7365beabb32b7aa77cf0e890ee90ea0f\",\"name\":\"ordba\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/test.samplewebsitelink.com\/ordba\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dd4335bb4e225c36ce7c56a0aff84bb202ebb523ebdc5d1e1a11cc3f3e6085f3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/dd4335bb4e225c36ce7c56a0aff84bb202ebb523ebdc5d1e1a11cc3f3e6085f3?s=96&d=mm&r=g\",\"caption\":\"ordba\"},\"sameAs\":[\"https:\/\/test.samplewebsitelink.com\/ordba\"],\"url\":\"https:\/\/test.samplewebsitelink.com\/ordba\/author\/ordba\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure - Ordba","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/","og_locale":"en_US","og_type":"article","og_title":"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure - Ordba","og_description":"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure Applies to:&nbsp;SQL Server (all supported versions) This topic contains a sample that introduces you to the syntax for In-Memory OLTP. To enable an application to use In-Memory OLTP, you need to complete the following tasks: Background on In-Memory objects For information on how to use &hellip; Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure Read More &raquo;","og_url":"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/","og_site_name":"Ordba","article_published_time":"2023-11-22T00:41:48+00:00","article_modified_time":"2023-11-22T00:41:50+00:00","og_image":[{"width":600,"height":539,"url":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-content\/uploads\/2023\/11\/creating-memory-optimized-table.jpg","type":"image\/jpeg"}],"author":"ordba","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ordba","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/","url":"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/","name":"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure - Ordba","isPartOf":{"@id":"https:\/\/test.samplewebsitelink.com\/ordba\/#website"},"datePublished":"2023-11-22T00:41:48+00:00","dateModified":"2023-11-22T00:41:50+00:00","author":{"@id":"https:\/\/test.samplewebsitelink.com\/ordba\/#\/schema\/person\/7365beabb32b7aa77cf0e890ee90ea0f"},"breadcrumb":{"@id":"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/test.samplewebsitelink.com\/ordba\/2023\/11\/22\/creating-a-memory-optimized-table-and-a-natively-compiled-stored-procedure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/test.samplewebsitelink.com\/ordba\/"},{"@type":"ListItem","position":2,"name":"Creating a Memory-Optimized Table and a Natively Compiled Stored Procedure"}]},{"@type":"WebSite","@id":"https:\/\/test.samplewebsitelink.com\/ordba\/#website","url":"https:\/\/test.samplewebsitelink.com\/ordba\/","name":"Ordba","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/test.samplewebsitelink.com\/ordba\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/test.samplewebsitelink.com\/ordba\/#\/schema\/person\/7365beabb32b7aa77cf0e890ee90ea0f","name":"ordba","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/test.samplewebsitelink.com\/ordba\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/dd4335bb4e225c36ce7c56a0aff84bb202ebb523ebdc5d1e1a11cc3f3e6085f3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd4335bb4e225c36ce7c56a0aff84bb202ebb523ebdc5d1e1a11cc3f3e6085f3?s=96&d=mm&r=g","caption":"ordba"},"sameAs":["https:\/\/test.samplewebsitelink.com\/ordba"],"url":"https:\/\/test.samplewebsitelink.com\/ordba\/author\/ordba\/"}]}},"_links":{"self":[{"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/posts\/663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/comments?post=663"}],"version-history":[{"count":1,"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/posts\/663\/revisions"}],"predecessor-version":[{"id":665,"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/posts\/663\/revisions\/665"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/media\/664"}],"wp:attachment":[{"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/media?parent=663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/categories?post=663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/test.samplewebsitelink.com\/ordba\/wp-json\/wp\/v2\/tags?post=663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}