Scenario:
You have created table dbo.Customer by using below script in Database TechBrothersIT.
CREATE TABLE [dbo].[Customer]( [FName] [varchar](50) NULL, [LName] [varchar](30) NULL, [Age] [tinyint] NULL, [PhoneNumber] [char](9) NULL, [DOB] [date] NULL, [Gender] [char](1) NULL )
You received new requirement.You have to add new column "Address" to table and delete Column "Gender" from Table.
Solution:
In SSMS, you can use Design window to add columns and drop columns. You can also script the changes to run in other environments such as QA,UAT and Production.
Step 1:
Go to Database and then Tables tab and then find your required table. Right Click on Table and select Design.
How to Add Column or Drop Column in Design Windows in SSMS- SQL Server Tutorial
Step 2:
Design windows will open, Go ahead at the end and add new column. Provide the Column Name and Data Type and if you would like to allow Null values for it or not.
Add Column to SQL Server Table in Design Mode in SSMS - TSQL Tutorial
To Delete Column, Choose the Column and Then hit Right Button on your mouse and click Delete Column as shown below.
How to Delete Column in Design Windows from SQL Server Table - T-SQL Tutorial
Now you have two options, if you would like to save the changes to table, Go ahead and hit Save button. If you want to script the changes, Click on Generate Scripts Button so you can use in any environment.
Generate Add or Drop Column Scripts from Design Windows in SSMS - SQL Server Tutorial
Once you hit Generate Change Script Button, Below windows will appear and ask you to save the scripts as shown below.
Add Column or Drop Column Scripts for SQL Server Table - T-SQL Tutorial
Video Demo : How to generate Add Column or Drop Column Statement from GUI in SQL
I really love your write-ups guys continue the good work.
ReplyDeleteuser experience firm
hhhhhhhhhhhhh
ReplyDeleteThank you ever so much for the efforts. You guys are really amazing.
ReplyDeleteRespect his honesty and check out to shield me from liability. He looks out for the patron.
ReplyDeletebest web design San Francisco
What a high-quality quantity of information concerning UX, first-rate possible counseling at home for dwelling a glad existence and dwelling it to the whole edge method experience design firm!
ReplyDeletebest logo designs
This blog post is really great; the standard stuff of the post is genuinely amazing.
ReplyDeletebrand marketing firm