sql server2016中的内存优化表/内存表

use master

go

--[1.0] create database

create database test3;

--[1.1] create filegroup contains memory_optimized_data;

alter database test3

add filegroup memory_FG CONTAINS memory_optimized_data;

go

--[2.0]

use master;

--create a store folder for memory_fg

alter database test3

add file

(

name='memory_on_file',

filename='D:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\memory_fg_file'

)

to filegroup memory_FG

go

--[3.0] create a memory table

use test3;

create table memory_test

(

id int not null primary key nonclustered hash with(bucket_count=1024)

,st1 nvarchar(100)

,st2 nvarchar(100)

)

with (memory_optimized=on,durability=schema_and_data);

insert into memory_test values(1,'a','b');

go

use test3;

create table AATB1DU

(

[DIInc] [int] IDENTITY(1,1) NOT NULL primary key nonclustered hash with(bucket_count=1024)

,[AID] [numeric](9, 4) NULL,

[ASub] [numeric](9, 4) NULL,

[EID] [int] NULL,

[DID] [int] NOT NULL,

[DNo] [varchar](50) NOT NULL,

[DNoX] [varchar](50) NULL,

[DName] [nvarchar](250) NULL,

[DQCode] [varchar](10) NULL,

[DDescribe] [nvarchar](250) NULL,

[PDID] [int] NULL,

[DSeq] [tinyint] NULL,

[CDT] [datetime] NULL,

[MDT] [datetime] NULL,

)

with (memory_optimized=on,durability=schema_and_data);

----

--create view V_AATB1DU

--as

--select DIInc, AID, ASub, EID, DID, DNo, DNoX, DName, DQCode, DDescribe, PDID, DSeq, CDT, MDT

--from QIRM3021C.dbo.AATB1DU

---delete from AATB1DU_

select DIInc, AID, ASub, EID, DID, DNo, DNoX, DName, DQCode, DDescribe, PDID, DSeq, CDT, MDT

into AATB1DU_ from QIRM3021C.dbo.AATB1DU

--delete from AATB1DU_

--DROP TABLE [dbo].[AATB1DU_]

--GO

insert into AATB1DU_ ( AID, ASub, EID, DID, DNo, DNoX, DName, DQCode, DDescribe, PDID, DSeq, CDT, MDT

)

select AID, ASub, EID, DID, DNo, DNoX, DName, DQCode, DDescribe, PDID, DSeq, CDT, MDT

from QIRM3021C.dbo.AATB1DU

select * from AATB1DU_

---插入内存优化表

insert into AATB1DU ( AID, ASub, EID, DID, DNo, DNoX, DName, DQCode, DDescribe, PDID, DSeq, CDT, MDT

)

select AID, ASub, EID, DID, DNo, DNoX, DName, DQCode, DDescribe, PDID, DSeq, CDT, MDT

from AATB1DU_

delete from AATB1DU

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值