0
我遇到了導致出現以下錯誤的問題。SQL變量如果聲明
declare @transDate datetime = GETDATE();
declare @main_work_center as varchar(50) = 'PMOM';
declare @team as varchar(1) = '';
declare @full_work_center as varchar(50);
IF(@team = '' OR @team IS NULL) then
@full_work_center = @main_work_center;
else
@full_work_center = @main_work_center + @team;
end if
這是錯誤:Msg 156,Level 15,State 1,Line 5關鍵字'then'附近的語法錯誤。
'then'沒有在SQL Server if'後'使用。錯誤消息似乎很清楚。 –