create a table in mssql server

To create a table in sql server we cam follow two steps:

  1. Design View
  2. Using Query window

 

Design View

Click to open sql server management studio and login to the server.

Then select database by expanding database section

If you dont have any database then create it by right clicking on database and then create database.

create table expand database
create table expand database

Then Select database and expand it and right click on tables and click on new table.

create table using sql server design view
create table using sql server design view

Follow the data type with column names and allow nulls to fields which would be null or not null.

Now save the table by following Ctrl+S or save icon and give a table name .

create table and save in design view
create table and save in design view

Query 

To create a table using query window we need to use sql query.

The sql query to create table is:

CREATE TABLE [dbo].[mytable] (
[id] [bigint] NOT NULL,
[colum1] [varchar](50) NULL,
[column2] [datetime] NULL,
[column3] [bit] NULL
)

 

Happy coding

4 Replies to “create a table in mssql server”

Leave a Reply

Your email address will not be published. Required fields are marked *