SMALLDATETIMEFROMPARTS (Transact-SQL)SMALLDATETIMEFROMPARTS (Transact-SQL)

適用於: 是SQL Server 是Azure SQL Database 是Azure SQL 資料倉儲 是平行處理資料倉儲 APPLIES TO: yesSQL Server yesAzure SQL Database yesAzure SQL Data Warehouse yesParallel Data Warehouse

傳回指定日期和時間的 smlldatetime 值。Returns a smalldatetime value for the specified date and time.

主題連結圖示 Transact-SQL 語法慣例Topic link icon Transact-SQL Syntax Conventions

語法Syntax

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

引數Arguments

yearyear
指定年份的整數運算式。Integer expression specifying a year.

monthmonth
指定月份的整數運算式。Integer expression specifying a month.

dayday
指定日期的整數運算式。Integer expression specifying a day.

hourhour
指定小時的整數運算式。Integer expression specifying hours.

minuteminute
指定分鐘的整數運算式。Integer expression specifying minutes.

傳回類型Return Types

smalldatetimesmalldatetime

RemarksRemarks

此函式的功能與完全初始化之 smalldatetime 值的建構函式類似。This function acts like a constructor for a fully initialized smalldatetime value. 如果引數無效,將會引發錯誤。If the arguments are not valid, then an error is thrown. 如果要求的引數為 null,即會傳回 null。If required arguments are null, then null is returned.

函數可以在 SQL Server 2017SQL Server 2017 伺服器和更新版伺服器上以遠端方式進行。This function is capable of being remoted to SQL Server 2017SQL Server 2017 servers and above. 它在版本低於 SQL Server 2017SQL Server 2017 的伺服器上無法以遠端方式運作。It is not remoted to servers that have a version below SQL Server 2017SQL Server 2017.

範例Examples

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

以下為結果集:Here is the result set.

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