需要帮助...以下查询在尝试使用 IF Else 时出错。SERIAL_NUMBER 字段中有两位数的年份,我想提取它并在它自己的字段中将其显示为 4 位数的年份。
SELECT
[START_TIMESTAMP]
,[END_TIMESTAMP]
,[SERIAL_NUMBER]
,[MODEL]
,[TESTING_ACTION_RESULT]
,[FAILED_STEP]
,[DISPOSITION]
,[TesterId]
,[Location]
,[Customer]
,IF CAST(substring([SERIAL_NUMBER],3,2)AS INT)>90
'19'+substring([SERIAL_NUMBER],3,2) AS MFG_YYYY
ELSE
'20'+substring([SERIAL_NUMBER],3,2) AS MFG_YYYY
FROM [DATABASE_1].[dbo].[TBL_Unit_Test]
GO