Add default date to column in SQL Server 2008

InfoPath alternatives for form designing SharePoint

In this post we will discuss how we can insert default datetime to a column in sql server 2008 in management studio as well as by using query.

In my previous posts we have discussed about Delete record using enterprise library in Asp.Net [Read here], Add new column to existing table in sql server 2008 [Read here] and WCF tutorial and example in C#.Net.

As we know through the use of GETDATE() function we can get the current date time in SQL server 2008.

Below is the query to add default date value to a column.

CREATE TABLE Employees
(
EmpId int NOT NULL PRIMARY KEY,
Name varchar(50) NOT NULL,
JoiningDate datetime NOT NULL DEFAULT GETDATE()
)

Check the below figure to add default value using Management Studio.

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