Preview Content - log in or Buy Access Pass

SQL alter table add column

Author(s): by Katie Glownia & by Emil Glownia


In this tutorial lesson I will show you how to use SQL add column command that will add new column to existing table. Our example will be presented using MS SQL Server 2008 R2.

SQL Add Column overview

Before we go into the details let me just say that adding a column is relatively easy; we just need to start with ALTER TABLE and specify the table name (if you use more than one schema in your database you will also have to specify it) after that we'll just need to use SQL Server ALTER TABLE Add column command and specify column properties. Below I will describe column properties you can set:

Column Name - This is obviously mandatory.
Column Date Type - This property is also mandatory and describes the type of values you want to store in the new field.
"Allow NULLs" - This property tells us if the field is mandatory or not and Accepts two values NULL or NOT NULL. If you omit this property a default setting will be used which NULL and means the field is not mandatory (optional).
There are several other popular column properties that you can add to your statement like defaul value, constraint, enable/disable trigger.

SQL Add column examples

In our example we will use the table below (‘Person’) in database ‘tutorial’ and using SQL Server ALTER TABLE Add column ‘PersonCity’.

To access members only content...
Log in (active member) or buy Access Pass
Learn as much as you like
Unlimited learning access pass*
* Secure one off payment, no re-occuring payments, no need to cancel!
T-SQL SSIS SSRS 79 Mini Courses 529 Pages 287 Videos 314 Articles
Forum Live Webinars 12 Webinar Recordings DIY Projects Progress Tracking
New member joins every 8 hours

60 days, 100% money back guarantee
NO risks, NO questions asked, NO hard feelings

I can't speak highly enough of the quality MSBI materials industry practitioners with varying level of experience and exposure can benefit from this website. Their structured learning plan and courses, DIY projects, webinars and relevant resources go a very long way. I've gained a whole new perspective on delivering client BI projects to highest standards by employing best practices recommended on this website. Best quality MSBI training online suite I have used and least expensive too.

Franklin Demilade Osinowo

Best and affordable BI Training platform in the web. KEBI Academy doesn't provide training on BI rather their approach is to make you learn BI by yourself. Self Learning is always the best approach and I recommend KEBI Academy.

Jaiyaram Mahendran

You both are doing a great job by sharing your knowledge and experience, it helps many people who want to learn MSBI from the starting point and also for an experienced person to get to know more about MSBI. Thank you and keep sharing your MSBI knowledge and experience.

Shweta Patel

Great work on the videos. I have been enjoying them.

Patt Nelson

Did you find this page useful?
+2  |  -0
(2 Votes)