A sysntax error

  • Hi

    this is my store procedure

    ALTER PROCEDURE [dbo].[ConnectionCourseEmpProc]

    @VarEmp_Id int,

    @VarCourse_Id int

    as

    BEGIN

    insert into ConnectionCourseEmp (Emp_Id) values(@varEmp_Id)

    where Course_I=@VarCourse_Id

    END

    there is a syntax error near 'where' and i dont know what is it,

    would you please help me?

  • You don't put a WHERE clause on an INSERT statement.

    I'm guessing from the name of the table that this is a link table between an Employee and a Course, so this is probably what you want...

    ALTER PROCEDURE [dbo].[ConnectionCourseEmpProc]

    @VarEmp_Id int,

    @VarCourse_Id int

    as

    BEGIN

    insert into ConnectionCourseEmp (Emp_Id, Course_I) values(@varEmp_Id,I=@VarCourse_Id)

    END

  • Hi nazaninahmady_sh..

    Can you show your table structure and make your requirement little clear..

    but whatever you are trying now is incorrect syntax because insert statement syntax doesn't contain a where condition in it..

    [font="Comic Sans MS"]Praveen Goud[/font]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply