Create Table in SQL

In this example i show you How you can create New table in a Database.

For my example i use tempDB database.

 

 

–use tempDB database context

use tempDB;

–Drop Employee table if already exists in tempDB database

If OBJECT_ID(‘dbo.Empluyee’,‘U’) is NOT NULL

Drop Table dbo.Employee;

–Create Employee table having 4 columns

CREATE TABLE dbo.Employees

(

empid INT NOT NULL,

firstname VARCHAR(30) NOT NULL,

lastname VARCHAR(30) NOT NULL,

salary MONEY NOT NULL

);

Advertisements

About Ashish Jain

I am Ashish Jain, a software engineer by profession. My goal of creating this blog is to share my knowledge of SQL server with all other SQL enthusiasts and also to learn from them.
This entry was posted in T-SQL and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s