我試圖將此查詢從Microsoft訪問轉換爲SQL Server 2012。將訪問SQL轉換爲SQL服務器
SELECT
IIF(IsNull(Letter), '', CalculationType) AS [BF NI Calculation Basis]
FROM NICs
我把它轉換成follwing,但我不斷收到錯誤:
Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value 'A' to data type int.
這是我曾嘗試:
SELECT
CHOOSE(ISNULL(Letter,0), '', CalculationType) AS [BF NI Calculation Basis]
FROM NICs
和
SELECT
IIF(Letter = 0, '', CalculationType) AS [BF NI Calculation Basis]
FROM NICs
CalculationType的數據類型是什麼? – 2014-08-27 08:45:53
@KrishnrajRana它是詮釋 – user3734454 2014-08-27 08:47:15
檢查我的答案... – 2014-08-27 09:00:10