Problem with writing a storeprocedure that should perform like an append query

  • Can someone help me please? I have been dealing with this problem for 2 days now. Please Please Help me.

    I want to write a storeprocedure that perform the work of an append query that I maked in access, i want to use it in sql server so it can append the records to a specific table.

    But I do not know how to write the procedure, paste it as it is in access but it gives me error.

    So I want to make the procedure so that when I enter the info in the form in access, and when I click the button save it runs the procedure so it can update the table.So I have to associate the button with the procudure.

    My query that I made in access is as follow:

    Code:

    INSERT INTO Marks ( Student_Id, Course_Id, Grupo_Id )

    SELECT Attendance.Student_Id, Course.Course_Id, Attendance.Grupo_Id

    FROM Grupo_Section INNER JOIN (Course INNER JOIN ((Grupo INNER JOIN Attendance ON Grupo.Grupo_Id = Attendance.Grupo_Id) INNER JOIN Student ON Attendance.Student_Id = Student.Student_Id) ON Course.Course_Id = Grupo.Course_Id) ON (Grupo_Section.Grupo_Date = Attendance.Grupo_Date) AND (Grupo_Section.Grupo_Id = Attendance.Grupo_Id) AND (Grupo_Section.Grupo_Id = Grupo.Grupo_Id)

    GROUP BY Attendance.Student_Id, Course.Course_Id, Attendance.Grupo_Id, Attendance.Grupo_Id, Course.Course_Levelid, Attendance.Attend

    HAVING (((Course.Course_Levelid)="N1") AND ((Attendance.Attend)=-1) AND ((Count(Attendance.Attend))=1)) OR (((Course.Course_Levelid)="N2") AND ((Attendance.Attend)=-1) AND ((Count(Attendance.Attend))>=3));

    How can use this in sql server 2005?

  • Are you using Access as a front end?

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

  • yes, i am using access as a front-end

  • If you post your table structure and sample data, and your desired results based on your sample data, we will be able to help you more effectively.

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

Viewing 4 posts - 1 through 4 (of 4 total)

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