.NET Programming With Me

SQL Server: CTAS - Create Table As SELECT

CTAS stands for 'Create Table As SELECT'.

This method is used when table was not created earlier and needs to be created using data from another table. The new table is created using same data types as of the prior table.

Example:

USE AdventureWorks
GO

SELECT FirstName, LastName
INTO MyTable
FROM Person.Contact
WHERE EmailPromotion = 2


Reference : http://blog.sqlauthority.com/

No comments: