I try to make a query and it works well, but when i put it in a stored procedure.I can't figure out whats wrong with my code. It says
Procedure or function has too many arguments specified
Stored procedure code
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[uspEnrolledStudents]
-- Add the parameters for the stored procedure here
@SchoolYear Nvarchar(20),
@levels Nvarchar(20),
@Section Nvarchar(20),
@DateEnrolled Date
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @studID INT
INSERT INTO StudentHistory(SchoolYear,Levels,Section,DateEnrolled,StudentID)
VALUES(@SchoolYear,@levels,@Section,@DateEnrolled,@studID)
END
I Execute it with this code:
EXEC dbo.uspEnrolledStudents '2016-2017','GRADE 11','SAINT RAMON','2015-1-2','380'