2
我有以下兩個查詢,第一個按照您的預期工作。第二個引發了一個例外說無效列名稱ISDELETED。但我已經添加的if else結構正是爲了避免這種錯誤,我在做什麼錯在第二個查詢SQL語句調試
IF COL_LENGTH('vwAs', 'IsActive') IS NOT NULL
select 1
ELSE IF COL_LENGTH('vwABCs', 'IsDeleted') IS NOT NULL
select 0
ELSE SELECT -1
而且
IF COL_LENGTH('vwAs', 'IsActive') IS NOT NULL
select Count(*) [vwB] from [vwAs] WHERE ISACTIVE = 1
ELSE IF COL_LENGTH('vwABCs', 'IsDeleted') IS NOT NULL
select Count(*) [vwABCsActive] from [vwABCs] WHERE ISDELETED = 0
ELSE SELECT -1
你是一個拯救生命的人謝謝你! – Yohannes