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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
DBAduck - Ben MillerPrincipal ConsultantCommented:
0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
enrique_aeoAuthor Commented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.