參考: DECLARE @D DATETIME = GETDATE() SELECT DATEPART(YEAR,@D) AS [YEAR], DATEPART(MONTH,@D) AS [MONTH], DATEPART(DAY,@D) AS [DAY] SELECT YEAR(@D) AS [Y ...
參考:
DECLARE @D DATETIME = GETDATE() SELECT DATEPART(YEAR,@D) AS [YEAR], DATEPART(MONTH,@D) AS [MONTH], DATEPART(DAY,@D) AS [DAY] SELECT YEAR(@D) AS [YEAR], MONTH(@D) AS [MONTH], DAY(@D) AS [DAY]Source Code