Skip to content

Latest commit

 

History

History
74 lines (54 loc) · 2.17 KB

smalldatetimefromparts-transact-sql.md

File metadata and controls

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

SMALLDATETIMEFROMPARTS (Transact-SQL)

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

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 )  

[!INCLUDEsql-server-tsql-previous-offline-documentation]

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)