The CREATE TABLE statement in SQL Server is used to create a new table in a database, this statement comes under SQL Server Data Definition Language (DDL) commands.
Syntax: CREATE TABLE table_A ( column1 datatype, column2 datatype, column3 datatype, ....);
Create new Table in SQL Server:
Example: CREATE TABLE tblemp( empId int , firstName varchar(255), lastName varchar(255), IdentityNo varchar(50), deptName varchar(255), AddedOn datetime );

Create Table in SQL
Set Identity and Primary key in new Table:
Example: CREATE TABLE tblempNew( empId int Identity(1,1) Primary Key , firstName varchar(255), lastName varchar(255), IdentityNo varchar(50), deptName varchar(255), AddedOn datetime );
Another way to Create new table from existing table:
In this way you can create table to using an existing table and it will create and copy existing table data into new table.
Syntax: Select column 1, column 2.... Column n INTO new_table FROM existing_table
Example:
Suppose you have an existing table like as below

SQL Server Select Statement
Now use Select INTO statement to copy table structure & data from existing table
Example: Select EmployeeKey, FirstName, LastName --Select Column from exsisting table INTO new_DimEmployee--New Table Name FROM [dbo].[DimEmployee]---Existing Table Name
- SELECT INTO Statements
- SELECT Data
Hope you enjoy the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.
Recommended SQL Server Post: