Tutorial by Examples

-- Create demo database CREATE DATABASE SQL2016_Demo ON PRIMARY ( NAME = N'SQL2016_Demo', FILENAME = N'C:\Dump\SQL2016_Demo.mdf', SIZE = 5120KB, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'SQL2016_Demo_log', FILENAME = N'C:\Dump\SQL2016_Demo_log.ldf', ...
SELECT OBJECT_ID('MemOptTable1') AS MemOptTable1_ObjectID, OBJECT_ID('MemOptTable2') AS MemOptTable2_ObjectID GO SELECT name,description FROM sys.dm_os_loaded_modules WHERE name LIKE '%XTP%' GO Show all Memory Optimized Tables: SELECT name,type_desc,durability_desc,...
For example, this is traditional tempdb-based table type: CREATE TYPE dbo.testTableType AS TABLE ( col1 INT NOT NULL, col2 CHAR(10) ); To memory-optimize this table type simply add the option memory_optimized=on, and add an index if there is none on the original type: CREATE TYPE dbo....
For faster performance you can memory-optimize your table variable. Here is the T-SQL for a traditional table variable: DECLARE @tvp TABLE ( col1 INT NOT NULL , Col2 CHAR(10) ); To define memory-optimized variables, you must first create a memory-optimized table type and...
CREATE TABLE [dbo].[MemOptimizedTemporalTable] ( [BusinessDocNo] [bigint] NOT NULL, [ProductCode] [int] NOT NULL, [UnitID] [tinyint] NOT NULL, [PriceID] [tinyint] NOT NULL, [SysStartTime] [datetime2](7) GENERATED ALWAYS AS ROW START NOT NULL, [SysEndTime] [datetime2](7...

Page 1 of 1