Database Reference
In-Depth Information
CountryRegionCode nvarchar(3) NOT NULL,
Name VARCHAR(50) NOT NULL,
TerritoryID int NOT NULL,
ModifiedDate datetime NOT NULL CONSTRAINT DF_StateProvince_ModifiedDate DEFAULT (getdate())
) WITH (MEMORY_OPTIMIZED=ON);
CREATE TABLE dbo.CountryRegion(
CountryRegionCode nvarchar(3) NOT NULL,
Name VARCHAR(50) NOT NULL,
ModifiedDate datetime NOT NULL CONSTRAINT DF_CountryRegion_ModifiedDate DEFAULT (getdate()),
CONSTRAINT PK_CountryRegion_CountryRegionCode PRIMARY KEY CLUSTERED
(
CountryRegionCode ASC
));
That's an additional memory-optimized table and a standard table. I'll also load data into these so you can make
more interesting queries.
SELECT sp.StateProvinceCode,
sp.CountryRegionCode,
sp.Name,
sp.TerritoryID
INTO dbo.StateProvinceStaging
FROM AdventureWorks2012.Person.StateProvince AS sp;
INSERT dbo.StateProvince
(StateProvinceCode,
CountryRegionCode,
Name,
TerritoryID
)
SELECT stateprovincecode,
countryregioncode,
name,
territoryid
FROM dbo.stateprovincestaging;
DROP TABLE dbo.StateProvinceStaging;
INSERT dbo.countryregion
(countryregioncode,
name
)
SELECT cr.CountryRegionCode,
cr.Name
FROM AdventureWorks2012.Person.CountryRegion AS cr;
Search WWH ::




Custom Search