Skip to content

Latest commit

 

History

History
75 lines (55 loc) · 2.11 KB

File metadata and controls

75 lines (55 loc) · 2.11 KB
title SMALLDATETIMEFROMPARTS (Transact-SQL)
description SMALLDATETIMEFROMPARTS (Transact-SQL)
author MikeRayMSFT
ms.author mikeray
ms.date 01/29/2021
ms.service sql
ms.subservice t-sql
ms.topic reference
ms.custom
ignite-2025
f1_keywords
SMALLDATETIMEFROMPARTS
SMALLDATETIMEFROMPARTS_TSQL
helpviewer_keywords
SMALLDATETIMEFROMPARTS function
dev_langs
TSQL
monikerRange >=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb

SMALLDATETIMEFROMPARTS (Transact-SQL)

[!INCLUDE sql-asdb-asdbmi-asa-pdw-fabricsqldb]

Returns a smalldatetime value for the specified date and time.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

SMALLDATETIMEFROMPARTS ( year, month, day, hour, minute )  

Arguments

year
Integer expression specifying a year.

month
Integer expression specifying a month.

day
Integer expression specifying a day.

hour
Integer expression specifying hours.

minute
Integer expression specifying minutes.

Return Types

smalldatetime

Remarks

This function acts like a constructor for a fully initialized smalldatetime value. If the arguments are not valid, then an error is thrown. If required arguments are null, then null is returned.

This function is capable of being remoted to [!INCLUDEsssql11-md] servers and above. It is not remoted to servers that have a version below [!INCLUDEsssql11-md].

Examples

SELECT SMALLDATETIMEFROMPARTS ( 2010, 12, 31, 23, 59 ) AS Result  

[!INCLUDEssResult]

Result  
---------------------------  
2010-12-31 23:59:00  
  
(1 row(s) affected)