如何這個動態查詢轉換爲普通的SQL查詢如何這個動態查詢轉換爲普通的SQL查詢
SET @SQL = 'SELECT DelayId, DelayCategory, DelayReason FROM [TAMS].[DelayMaintenance] WHERE IsUtilized = 1 AND ' + @CHECKPOINTTYPE + ' = ' + CAST(1 AS CHAR(1)) +
' union SELECT 0, NULL, ''--- Pick One----'' ORDER BY DelayId'
EXEC (@SQL)
這取決於'@ CHECKPOINTTYPE'的價值 - 它是一個標量值或列名? – RedFilter
其列名 – user1030181