我試圖創建一個輸入參數過程 但我具有它消息102,級別15,狀態1,過程CaseSummary,第18行附近有語法錯誤「結束」
create procedure CaseSummary (@client_id int='')
as
begin
if exists(select Client_ID from [Client] where Client_ID= @client_id)
begin
SELECT CaseRegister.Client_ID,CaseRegister.Case_ID, CaseAssign.Lawyer_ID , Document.Doc_ID, CaseToCourt.Court_ID, CaseToJudge.J_ID,
CaseDetail.Result, Clauses.Clause_ID, SubClauses.SC_ID
FROM(((((((((CaseAssign
INNER JOIN Lawyer ON CaseAssign.Lawyer_ID = Lawyer.Lawyer_ID)
Inner Join CaseRegister ON CaseAssign.CR_ID = CaseRegister.CR_ID)
Inner Join Client ON Client.Client_ID = CaseRegister.Client_ID)
Inner Join Document On Document.Client_ID= Client.Client_ID)
Inner JOIn CaseToCourt On CaseToCourt.CR_ID= CaseRegister.CR_ID)
Inner Join CaseToJudge On CaseToJudge.CR_ID = CaseRegister.CR_ID)
Inner Join CaseDetail on CaseDetail.CJ_ID = CaseToJudge.CJ_ID)
Inner join Clauses on Clauses.CD_ID = CaseDetail.CD_ID)
Inner Join SubClauses on SubClauses.Clause_ID = Clauses.Clause_ID);
END
錯誤錯誤:
Msg 102, Level 15, State 1, Procedure CaseSummary, Line 18 Incorrect syntax near 'end'.
1)加入也沒有括號進行包裹。我不會試圖弄清楚*這些*在這裏是否平衡,2)我計算兩個「開始」和只有一個「結束」。 –