Database Reference
In-Depth Information
INSERT dbo.AddressStaging
(AddressLine1,
AddressLine2,
City,
StateProvinceID,
PostalCode
)
SELECT a.AddressLine1,
a.AddressLine2,
a.City,
a.StateProvinceID,
a.PostalCode
FROM AdventureWorks2012.Person.Address AS a;
INSERT dbo.Address
(AddressLine1,
AddressLine2,
City,
StateProvinceID,
PostalCode
)
SELECT a.AddressLine1,
a.AddressLine2,
a.City,
a.StateProvinceID,
a.PostalCode
FROM dbo.AddressStaging AS a;
DROP TABLE dbo.AddressStaging;
You can't combine an in-memory table in a cross-database query, so I had to load the 19,000 rows into a staging
table and then load them into the in-memory table. This is not meant to be part of the examples for performance, but
it's worth nothing that it took nearly 850ms to insert the data into the standard table and only 2ms to load the same
data into the in-memory table on my system.
But, with the data in place, I can rerun the query and actually see results, as shown in Figure 23-1 .
Figure 23-1. The first query results from an in-memory table
Granted, this is not terribly exciting. So, in order to have something meaningful to work with, I'm going to create a
couple of other tables so that you can see some more query behavior on display.
CREATE TABLE dbo.StateProvince(
StateProvinceID int IDENTITY(1,1) NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_
COUNT=10000),
StateProvinceCode nchar(3) COLLATE Latin1_General_100_BIN2
NOT NULL,
 
Search WWH ::




Custom Search