I'm trying to create an input parameter procedure but i'm having error in it
我正在尝试创建一个输入参数过程,但我有错误
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
error:
错误:
Msg 102, Level 15, State 1, Procedure CaseSummary, Line 18 Incorrect syntax near 'end'.
消息102,级别15,状态1,过程CaseSummary,第18行'end'附近的语法不正确。
1 个解决方案
#1
0
Try this;
尝试这个;
create procedure CaseSummary (@client_id int='')
as
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
The 'begin' at the start either needs an 'end' at the end OR just don't specify it
开头的'begin'要么在结尾处需要'end',要么就是不要指定它
#1
0
Try this;
尝试这个;
create procedure CaseSummary (@client_id int='')
as
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
The 'begin' at the start either needs an 'end' at the end OR just don't specify it
开头的'begin'要么在结尾处需要'end',要么就是不要指定它