为什么我在此过程中收到语法错误

时间:2017-11-20 23:47:24

标签: sql sql-server

CREATE PROCEDURE AssignRegular
     @department AS INT,
     @project AS VARCHAR(100),
     @Employee AS VARCHAR(100)
AS
BEGIN
    DECLARE @result AS INT

    SELECT @result = COUNT(*) 
    FROM Managers_assign_Regular_Emplyee_Projects 
    WHERE regular_employee = @Employee

我在员工附近收到语法错误,并且不知道为什么

3 个答案:

答案 0 :(得分:4)

您错过了END以匹配BEGIN:

create proc AssignRegular
@department as int
,@project as varchar(100)
,@Employee as varchar(100)
as
BEGIN
Declare @result as int
select @result = count(*) from Managers_assign_Regular_Emplyee_Projects where regular_employee=@Employee
END

答案 1 :(得分:2)

你的错误是什么?我认为这是纠正的:

create procedure AssignRegular
(
@department int
,@project varchar(100)
,@Employee varchar(100)
)
as
BEGIN
Declare @result int
select @result = count(*) from Managers_assign_Regular_Emplyee_Projects where regular_employee=@Employee
END

答案 2 :(得分:0)

可能存在许多错误,表格的拼写等等。我们没有您要查看的架构或您的桌面布局等。

但我的猜测是你忘记了END语句以匹配你的BEGIN语句。