sql server 2014 - Transact-SQL Enhancements - SELECT … INTO

Hi experts,
I do not understand what new:
The SELECT … INTO statement is improved and can now operate in parallel. The database compatibility level must be at least 110.

You can explain with T-SQL code?
enrique_aeoAsked:
Who is Participating?
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
Yes, in order for SQL to decide to use Parallelism the row count has to be more significant that just 60,000 rows. He had 61 Million rows, so it would go parallel.
0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
There really isn't a difference in the TSQL code for this one.  It is simply saying that as long as you have compatibility mode 110 or 120 then whenever you do SELECT .. INTO it can choose to go parallel and use more than 1 processor to complete the SELECT INTO. No code change necessary.

SELECT *
INTO dbo.NewTable
FROM dbo.OldTable

Open in new window

0
 
enrique_aeoAuthor Commented:
there any way to prove that in sql server 2014 processors consume available?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
DBAduck - Ben MillerPrincipal ConsultantCommented:
0
 
enrique_aeoAuthor Commented:
DBAduck - Ben Miller:

I followed the steps outlined in the article, but I have not succeeded, please your support.

i try this:

use AdventureWorksDW2012
go

USE [master];
GO
ALTER DATABASE [AdventureWorksDW2012] SET COMPATIBILITY_LEVEL = 100;
GO

--Activar plan de ejecucion
use AdventureWorksDW2012
go

SELECT  [ProductKey],[OrderDateKey],[DueDateKey],[ShipDateKey],[CustomerKey],[PromotionKey],[CurrencyKey],
            [SalesTerritoryKey],[SalesOrderNumber],[SalesOrderLineNumber],[RevisionNumber],[OrderQuantity],[UnitPrice],
            [ExtendedAmount],[UnitPriceDiscountPct],[DiscountAmount],[ProductStandardCost],[TotalProductCost],[SalesAmount],
            [TaxAmt],[Freight],[CarrierTrackingNumber],[CustomerPONumber],[OrderDate],
            [DueDate],[ShipDate]
INTO dbo.FactInternetSales_V2
FROM dbo.FactInternetSales;

--
USE [master];
GO
ALTER DATABASE [AdventureWorksDW2012] SET COMPATIBILITY_LEVEL = 110;
GO

--
use AdventureWorksDW2012
go

drop table dbo.FactInternetSales_V2

SELECT  [ProductKey],[OrderDateKey],[DueDateKey],[ShipDateKey],[CustomerKey],[PromotionKey],[CurrencyKey],
            [SalesTerritoryKey],[SalesOrderNumber],[SalesOrderLineNumber],[RevisionNumber],[OrderQuantity],[UnitPrice],
            [ExtendedAmount],[UnitPriceDiscountPct],[DiscountAmount],[ProductStandardCost],[TotalProductCost],[SalesAmount],
            [TaxAmt],[Freight],[CarrierTrackingNumber],[CustomerPONumber],[OrderDate],
            [DueDate],[ShipDate]
INTO dbo.FactInternetSales_V2
FROM dbo.FactInternetSales;
0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
I believe the reason is that there were many more rows in his table as illustrated in his explanation.


SQL Server 2014 introduces parallel-enabled SELECT ... INTO for databases and to test this feature I used the AdventureWorksDW2012 database and a version of the FactInternetSales table that had 61,847,552 rows in it (I was responsible for adding those rows; they don’t come with the database by default).
0
 
enrique_aeoAuthor Commented:
i have 60398 rows. That is the reason?
0
 
enrique_aeoAuthor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.