Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
SQL Server 119
#SQLServer 88
Oracle 70
#SQL SERVER 35
BRH 31
SQL Server 2012 29
denali 23
#TSQL 19
TSQL 19
C# 15

Archive · View All
October 2011 31
November 2011 30
September 2011 30
August 2011 18
December 2011 15
July 2011 13
June 2011 8
May 2012 4
April 2012 3
January 2010 3

DateFromParts Function in Denali (SQL Server 2012), CTP 3

Aug 2 2011 3:12PM by Niladri Biswas   

Well,the function states that build a date given the various parts like year, month and day. We have already seen this function in dotnet. Out of the various overloaded constructor of DateTime struct, we have

public DateTime(int year, int month, int day);

So if we write

Console.WriteLine(new DateTime(2011, 7, 23));

The output will be: 7/23/2011 12:00:00 AM

Now we have the same opportunity to do from Sql Server with the help of DateFromParts.

Purpose: Returns a date given its parts like year, month, day.

Syntax: DateFromParts(year,month,day)

Where,

Year => the year value

Month => the month value

Day => Day value.

Example 1: Simple example

Select DateFromParts(2011,7,23) [Result]

/*
	Result
	------
	2011-07-23
*/

Example 2: Specifying all nulls

Select DateFromParts(null,null,null) [Result]

/*
	Result
	------
	 Null
*/

Example 3: Omitting mandatory fields will raise exception

Select DateFromParts(2011,23) [Result]

Msg 174, Level 15, State1, Line1
The datefromparts function requires 3 argument(s)

Example 4: Inserting value 2 for all the fields

Select DateFromParts(2,2,2) [Result]

/*
	 Result
	 ------
	 0002-02-02
*/

Hope this helps

Tags: BRH, denali, #SQLServer, SQL Server, DateFromParts, SQL Server 2012,


Niladri Biswas
7 · 21% · 6710
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]