# CURRENT_TIMESTAMP (Transact-SQL)CURRENT_TIMESTAMP (Transact-SQL)

`SYSDATETIME``SYSUTCDATE``GETDATE``GETUTCDATE` 具有更高的精確度，以小數秒數有效位數來度量。`SYSDATETIME` and `SYSUTCDATE` have more precision, as measured by fractional seconds precision, than `GETDATE` and `GETUTCDATE`. `SYSDATETIMEOFFSET` 函式包含系統時區位移。The `SYSDATETIMEOFFSET` function includes the system time zone offset. 您可以將 `SYSDATETIME``SYSUTCDATE``SYSDATETIMEOFFSET` 指派給任何日期和時間類型的變數。You can assign `SYSDATETIME`, `SYSUTCDATE`, and `SYSDATETIMEOFFSET` to a variable of any of the date and time types.

## 語法Syntax

``````CURRENT_TIMESTAMP
``````

datetimedatetime

## RemarksRemarks

`CURRENT_TIMESTAMP` 是非決定性函數。`CURRENT_TIMESTAMP` is a nondeterministic function. 參考這個資料行的檢視和運算式，是無法編製索引的。Views and expressions that reference this column cannot be indexed.

## 範例Examples

### A.A.取得目前的系統日期和時間Get the Current System Date and Time

``````SELECT SYSDATETIME()
,SYSDATETIMEOFFSET()
,SYSUTCDATETIME()
,CURRENT_TIMESTAMP
,GETDATE()
,GETUTCDATE();
/* Returned:
SYSDATETIME()      2007-04-30 13:10:02.0474381
SYSDATETIMEOFFSET()2007-04-30 13:10:02.0474381 -07:00
SYSUTCDATETIME()   2007-04-30 20:10:02.0474381
CURRENT_TIMESTAMP  2007-04-30 13:10:02.047
GETDATE()          2007-04-30 13:10:02.047
GETUTCDATE()       2007-04-30 20:10:02.047
*/
``````

### B.B.取得目前的系統日期Get the Current System Date

``````SELECT CONVERT (date, SYSDATETIME())
,CONVERT (date, SYSDATETIMEOFFSET())
,CONVERT (date, SYSUTCDATETIME())
,CONVERT (date, CURRENT_TIMESTAMP)
,CONVERT (date, GETDATE())
,CONVERT (date, GETUTCDATE());

/* Returned
SYSDATETIME()      2007-05-03
SYSDATETIMEOFFSET()2007-05-03
SYSUTCDATETIME()   2007-05-04
CURRENT_TIMESTAMP  2007-05-03
GETDATE()          2007-05-03
GETUTCDATE()       2007-05-04
*/
``````

### C.C.取得目前的系統時間Get the Current System Time

``````SELECT CONVERT (time, SYSDATETIME())
,CONVERT (time, SYSDATETIMEOFFSET())
,CONVERT (time, SYSUTCDATETIME())
,CONVERT (time, CURRENT_TIMESTAMP)
,CONVERT (time, GETDATE())
,CONVERT (time, GETUTCDATE());

/* Returned
SYSDATETIME()      13:18:45.3490361
SYSDATETIMEOFFSET()13:18:45.3490361
SYSUTCDATETIME()   20:18:45.3490361
CURRENT_TIMESTAMP  13:18:45.3470000
GETDATE()          13:18:45.3470000
GETUTCDATE()       20:18:45.3470000
*/
``````

## 範例：Azure SQL 資料倉儲Azure SQL Data Warehouse 和 平行處理資料倉儲Parallel Data WarehouseExamples: Azure SQL 資料倉儲Azure SQL Data Warehouse and 平行處理資料倉儲Parallel Data Warehouse

``````SELECT CURRENT_TIMESTAMP;
``````