Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
This function returns a date value that maps to the specified year, month, and day values.
Transact-SQL syntax conventions
DATEFROMPARTS ( year, month, day )
year
An integer expression that specifies a year.
month
An integer expression that specifies a month, from 1 to 12.
day
An integer expression that specifies a day.
date
DATEFROMPARTS
returns a date value, with the date portion set to the specified year, month and day, and the time portion set to the default. For invalid arguments, DATEFROMPARTS
will raise an error. DATEFROMPARTS
returns null if at least one required argument has a null value.
This function can handle remoting to SQL Server 2012 (11.x) servers and above. It cannot handle remoting to servers with a version below SQL Server 2012 (11.x).
This example shows the DATEFROMPARTS
function in action.
SELECT DATEFROMPARTS ( 2010, 12, 31 ) AS Result;
Here's the result set.
Result
----------------------------------
2010-12-31
(1 row(s) affected)
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today