Add new column to existing table in sql server 2008

InfoPath alternatives for form designing SharePoint

In this post we will discuss how to add a new column to an existing table in sql server 2008.

You can also check my previous posts on Solution for error Saving changes is not permitted sql 2008 [Solution here], WCF tutorial and example in C#.Net [Read here] and Left outer join and Right outer join in SQL Server [Read here].

You can add columns easily to an existing table in the database.

Below is a query which will add a DateTime type column which will not accept NULL value and put default value as the current datetime.

Use TestDB
ALTER TABLE Employees
ADD ModifiedDate DateTime NOT NULL DEFAULT(Getdate())
GO

Below is the query that will add a varchar type column to the table which can take NULL values.

Use TestDB
ALTER TABLE Employees
ADD Location varchar(200)null
GO

Check the figure to know about the table structure.

Similar SharePoint 2013 Tutorials


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply