Search this blog

Tuesday, July 28, 2009

DateTime2 Data Type - SQL 2008

DateTime2 is a New Data Type introduced in SQL 2008. It is an extension of existing data type Date Type. In DateTime2 is provides larger data range, and larger time fractional precision. It is a combination Data types “Date” and “Time” Data types which are introduced newly along with this DateTime2 in SQL 2008. Have a look at this link to know about Date and Time

Syntax: datetime2 [(fractional seconds precision)]

Fractional seconds precision – It allows 0 – 7 digits, default is 7 digits



Date range - 0001-01-01 through 9999-12-31(January 1, 1 AD through December 31, 9999 AD)

Time range
- 00:00:00 through 23:59:59.9999999

Default value
of this type is, 1900-01-01 00:00:00

Example:

DECLARE
@MyDatetime2 datetime2(7)

set @MyDatetime2 = GETDATE()

select @MyDatetime2

Sample Output of the above code:


2009-07-28 16:02:40.4370000

1 comment:

  1. I have heard about another way of corrupted dbffile repair. Besides, you can visit my blogs at: http://daspeac.livejournal.com/ or http://daspeac.blogspot.com/ where I’m trying to share my experience with regard to data corruption issues.

    ReplyDelete