Sunday, 6 July 2014

New Date and Time Functions in SQL Server 2012




DATEFROMPARTS:

Returns a date value for specified year,month and day.

Syntax:

DATEFROMPARTS(Year,Month,Day)

DATETIMEFROMPARTS:

Returns a datetime Value for specified values.

Syntax:

DATETIMEFROMPARTS(Year,Month,Day,Hours,Minutes,Second,Milliseconds)

DATETIME2FROMPARTS:

Returns a datetime2 value for specifies year,month and day with precision

Syntax:

DATETIME2FROMPARTS(Year,Month,Day,Hour,Minute,Second,Fractions,Precision)

SMALLDATETIMEFROMPARTS:

Returns Smalldatetime value for specified date.

Syntax:

SMALLDATETIMEFROMPARTS(Year,Month,Day,Hour,Minute)

TIMEFROMPARTS:

Returns a Time value

Syntax:

TIMEFROMPARTS(Hour,Minute,Second,Fractions,Precision)




EOMONTH :

Returns the last day of the month.

Syntax:

EOMONTH(startdate,monthtoadd)

Example:


No comments:

Post a Comment