How to Create table manually and by script in Sql Server 2008.

How to Create table manually and by script in Sql Server 2008.

In this tutorial i will explain how to Create table manually and by script in Sql Server. Table : A Table is a set of values and a table has a specified number of columns, but can have any number of rows.

1

There is two ways to create Sql Table
1. We can create table manually in Sql Server. Open Microsoft SQL Server Management Studio and select Database in which you want to create Table then Right Click on Table Menu and select New Table. Give Proper name, Data Type and Size of each Columns. You can set ID column as Primary Key.See below.

2

Primary key: Primary keys contain unique values and a primary key column cannot contain NULL values.

And in last Right Click on table Tab then click on Save Table and then Give Table Name.See below.

3

2.The second method is use to script for creating Table in SQL Server.

Right click on Database in which you want to make table then click on New Query menu ,New Query window will open right side as below,then write the script and after complete the script press f5.Table Created sucessfully.

4

Create table empoyee

(

EmpID int NOT NULL,

EmpName varchar(50) NOT NULL,

EmpAddress Varchar(50),

EmpMobile varchar(50),

PRIMARY KEY (EmpID)

)

About the author

admin administrator

Leave a Reply