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

Delete record using enterprise library in Asp.Net

– User Information List in SharePoint 2010

– Bind drop-down list from SharePoint list in InfoPath 2010

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.


You May Also like the Following SharePoint Online 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