; Tutorials - Table in Microsoft SQL Server | SQL Server

Internet Television

Watch World wide Tv Channels , Movies , Sports - Visit Here

Tutorials - Table in Microsoft SQL Server

How to create table in Microsoft SQL Server ?

If u want to store any data in Microsoft SQL Server database then u will have to create a table. So to create a table u should to keep a unique name of that table. In a table combination of column and row, each column define in bracket which content what type of data u insert. To creating a table in Microsoft SQL Server by heading syntax CREATE TABLE “table name” statement.
For example:
Below is an example to create a table in Microsoft SQL Server name “CUSTOMER” which contain his detail, and in which his fields/data cannot be NULL.
 CREATE TABLE CUSTOMERS
(
   ID   INT              NOT NULL,
   NAME VARCHAR (20)     NOT NULL,
   AGE  INT              NOT NULL,
   ADDRESS  CHAR (25) ,
   SALARY   DECIMAL (18, 2),      
   PRIMARY KEY (ID)
);
Execute a table.

To execute a table in Microsoft SQL Server, first you will select a query like below
Microsoft SQL Server table






















And then press F5 or press the execute button which located in top left in Microsoft SQL Server.
Microsoft SQL Server table
















Insert a data in Microsoft SQL Server table.

There are two basis ways to insert a data in Microsoft SQL Server table with the help of INSERT INTO syntax.  In 1st, u will define the column name while writing the syntax to inserting the data in Microsoft SQL Server.
Example
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)]  
VALUES (value1, value2, value3,...valueN);

INSERT INTO CUSTOMERS (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (1, 'Ramesh', 32, 'Ahmedabad', 2000.00 );

And in 2nd  You will directly put the values in that particular table.
Example

INSERT INTO TABLE_NAME VALUES (value1,value2,value3,...valueN);

INSERT INTO CUSTOMERS 
VALUES (7, 'Muffy', 24, 'Indore', 10000.00 );

How to view column of table in Microsoft SQL Server ?

By the select command you can view a column which you have created in Microsoft SQL Server.
Syntax:

Select * from “table name”

Example:

select * from customers

Microsoft SQL Server































How to delete a table from Microsoft SQL Server ?

By the Microsoft SQL Server drop statement you can delete the table along with all the data and command given on that particular table.
But make sure you have to delete the table and all its command; because once you have deleted the table then you’ll not recover the data which were saved in table.
Syntax:
DROP TABLE table_name;
E.g.;
DROP TABLE Customers;

select and press F5 .

Share on Google Plus

About Sujay Sharma

Hi ! I am Sujay Sharma. I am working in Indian Railway as Guard. I am sharing my experience about Microsoft SQL Server with ASP.NET ,VB.NET,C#.NET,XML "" Thanks.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment