SMALLDATETIMEFROMPARTS (Transact-SQL)SMALLDATETIMEFROMPARTS (Transact-SQL)
适用于:Applies to: SQL ServerSQL Server(所有支持的版本)
SQL ServerSQL Server (all supported versions)
Azure SQL 数据库Azure SQL Database
Azure SQL 数据库Azure SQL Database
Azure SQL 托管实例Azure SQL Managed Instance
Azure SQL 托管实例Azure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
并行数据仓库Parallel Data Warehouse
并行数据仓库Parallel Data Warehouse
SQL ServerSQL Server(所有支持的版本)
SQL ServerSQL Server (all supported versions)
Azure SQL 数据库Azure SQL Database
Azure SQL 数据库Azure SQL Database
Azure SQL 托管实例Azure SQL Managed Instance
Azure SQL 托管实例Azure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
并行数据仓库Parallel Data Warehouse
并行数据仓库Parallel Data Warehouse
为指定的日期和时间返回 smalldatetime 值。Returns a smalldatetime value for the specified date and time.
Transact-SQL 语法约定
Transact-SQL Syntax Conventions
语法Syntax
SMALLDATETIMEFROMPARTS ( year, month, day, hour, minute )
备注
若要查看 SQL Server 2014 及更早版本的 Transact-SQL 语法,请参阅早期版本文档。To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
参数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
备注Remarks
此函数的行为像完全初始化的 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 2012 (11.x)SQL Server 2012 (11.x) 服务器以及更高版本上远程执行。This function is capable of being remoted to SQL Server 2012 (11.x)SQL Server 2012 (11.x) servers and above. 但在 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 之下的服务器版本中无法远程执行。It is not remoted to servers that have a version below SQL Server 2012 (11.x)SQL Server 2012 (11.x).
示例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)