connectseekers.com

Saturday, 11 July 2015

Insert, Update, Delete, Select, Drop and Create Table In Ms Sql Server Database Table

7/11/2015 - By Pranav Singh 0

This article will show you how you can create or perform insert, update and delete, select, drop and create table operation in an sql server database.



Now we will create the template for the insert, update and delete query. For creating query check the path.

Go to Table -> Right click on table -> Script Table As

After this you will get below mention menu for Select, Insert, Update and delete. Now select one of the option and generate the query for that table.


CREATE:
CREATE TABLE [dbo].[UserDetail](
      [Id] [int] IDENTITY(1,1) NOT NULL,
      [Name] [varchar](50) NULL,
      [Address] [varchar](100) NULL,
      [UserType] [varchar](50) NULL,
      [Earning] [int] NULL,
 CONSTRAINT [PK_UserDetail] PRIMARY KEY CLUSTERED
(
      [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

INSERT:
INSERT INTO [dbo].[UserDetail]
           ([Name]
           ,[Address]
           ,[UserType]
           ,[Earning])
     VALUES
           (<Name, varchar(50),>
           ,<Address, varchar(100),>
           ,<UserType, varchar(50),>
           ,<Earning, int,>)
GO

UPDATE:
UPDATE [dbo].[UserDetail]
   SET [Name] = <Name, varchar(50),>
      ,[Address] = <Address, varchar(100),>
      ,[UserType] = <UserType, varchar(50),>
      ,[Earning] = <Earning, int,>
 WHERE <Search Conditions,,>
GO

DELETE:
DELETE FROM [dbo].[UserDetail]
      WHERE <Search Conditions,,>
GO

SELECT:
SELECT [Id]
      ,[Name]
      ,[Address]
      ,[UserType]
      ,[Earning]
  FROM [dbo].[UserDetail]
GO

DROP:
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserDetail]') AND type in (N'U'))
DROP TABLE [dbo].[UserDetail]
GO

About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top