如需所有 Transact-SQL 日期和時間資料類型與函式的概觀,請參閱日期和時間資料類型與函式 (Transact-SQL)。Transact-SQL 語法慣例語法syntaxsql 複製 SWITCHOFFSET ( datetimeoffset_expression, timezoneoffset_expression ) 引數datetimeoffset_expression 這是可解析成 datetimeoffset(n) 值的運算式。
Transact-SQL Syntax ConventionsSyntaxCopy SWITCHOFFSET ( DATETIMEOFFSET, time_zone ) ArgumentsDATETIMEOFFSET Is an expression that can be resolved to a datetimeoffset(n) value. time_zone Is a character string in the format [+|-]TZH:TZM or a signed integer (of minutes) that represents the time...
For an overview of all Transact-SQL date and time data types and functions, see Date and Time Data Types and Functions (Transact-SQL).Transact-SQL syntax conventionsSyntaxsyntaxsql Ikkopja SWITCHOFFSET ( datetimeoffset_expression, timezoneoffset_expression ) ...
hint to force the query optimizer to recompile a query plan the next time the same query is executed. The optimizer will then have accurate cardinality estimates and will produce a more efficient query plan. For more information about the RECOMPILE query hint, seeQuery Hints (Transact-SQL). ...
hint to force the query optimizer to recompile a query plan the next time the same query is executed. The optimizer will then have accurate cardinality estimates and will produce a more efficient query plan. For more information about the RECOMPILE query hint, seeQuery Hints (Transact-SQL). ...
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW) Returns a datetimeoffset value that is changed from the stored time zone offset to a specified new time zone offset. For an overview of all Transact-SQL date and time da...
SQL Server has many built-in/intrinsic functions. During query compilation, optimizer can actually ‘peek’ the value by ‘executing’ the function to provide better estimate. For example, if you use getdate() like (“select * from t where c1 > getdate()”), optimizer will be abl...
Option 1: SWITCHOFFSET sql SET STATISTICS TIME ON; SELECT CAST(SWITCHOFFSET(CreatedDate, '+00:00') AS date) AS UTCDate FROM Users; SET STATISTICS TIME OFF; Option 2: AT TIME ZONE sql SET STATISTICS TIME ON; SELECT CONVERT(date, CreatedDate AT TIME ZONE 'UTC') AS UTCDate FROM ...
Transact-SQL 语法约定 语法 SWITCHOFFSET ( DATETIMEOFFSET, time_zone ) 参数 DATETIMEOFFSET 是一个可以解析为 datetimeoffset(n) 值的表达式。 time_zone 是一个格式为 [+|-]TZH:TZM 的字符串,或是一个表示时区偏移量的带符号的整数(分钟数),假定它能够感知夏时制并作出相应的调整。
SQL Copiar CREATE TABLE dbo.test ( ColDatetimeoffset datetimeoffset ); GO INSERT INTO dbo.test VALUES ('1998-09-20 7:45:50.71345 -5:00'); GO SELECT SWITCHOFFSET (ColDatetimeoffset, '-08:00') FROM dbo.test; GO --Returns: 1998-09-20 04:45:50.7134500 -08:00 SELECT ColDatetimeoffset ...