简体   繁体   中英

Why am I getting a syntax error in this procedure

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

I am getting a syntax error near employee and don't know why

You're missing the END to match the 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

What is your error? I think this is the corrected:

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

There could be a number of things wrong, spelling of the table name, etc. We don't have your schema to view or your table layout, etc.

But my guess would be that you forgot the END statement to match your BEGIN statement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM