StudentTable
CREATE TABLE [Student].[StudentDetails](
[StudentId] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](35) NULL,
[IDNo] [varchar](10) NULL,
[NameofGuardian] [varchar](50) NULL,
[AddressofCommunication] [varchar](200) NULL,
[MobileNumber] [varchar](50) NULL,
[LandlineNumber] [varchar](20) NULL,
[Email] [varchar](50) NULL,
[AdmissionYear] [varchar](20) NULL,
[SectionID] [int] NULL,
[ClassID] [int] NULL,
[IsActive] [bit] NULL,
[IsDeleted] [bit] NULL,
[CreatedBy] [int] NULL,
[CreationDate] [datetime] NULL,
[ModifiedBy] [int] NULL,
[ModifiedDate] [datetime] NULL
)
USER DEFINED TABLE TYPE
CREATE TYPE [Student].[InsertBulkType] AS TABLE(
[Name] [varchar](35) NULL,
[IDNo] [varchar](10) NULL,
[NameofGuardian] [varchar](50) NULL,
[AddressofCommunication] [varchar](200) NULL,
[MobileNumber] [varchar](50) NULL,
[LandlineNumber] [varchar](20) NULL,
[Email] [varchar](50) NULL,
[AdmissionYear] [varchar](20) NULL,
[SectionID] [int] NULL,
[ClassID] [int] NULL
)
when i create procedure for bulk insert below error came
this is my procedure
Create PROCEDURE [Student].[InsertBulkStudent]
@tblStudent InsertBulkType READONLY
AS
BEGIN
INSERT INTO StudentDetails
SELECT Name,IDNo,NameofGuardian,AddressofCommunication,MobileNumber,LandlineNumber,
Email,AdmissionYear,SectionID,ClassID
FROM @tblStudent
end
error is
Msg 213, Level 16, State 1, Procedure InsertBulkStudent, Line 9
Column name or number of supplied values does not match table definition.
What I have tried:
Msg 213, Level 16, State 1, Procedure InsertBulkStudent, Line 9
Column name or number of supplied values does not match table definition.