Below is a stored Procedure I have wrote, However it fails with the following error
**************************************************
Server: Msg 213, Level 16, State 4, Procedure p_insertCustomer, Line 23
Insert Error: Column name or number of supplied values does not match table definition.
**************************************************
I have checked the syntax and I have checked and ensured all things exist in the table, I am at a loss. Please help.
**************************************************
IF exists(
SELECT * from SysObjects where name = 'p_insertCustomer' and type='P'
)
BEGIN
drop proc p_insertCustomer
END
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE p_insertCustomer
@Division varchar(2) = null,
@CustomerNumber varchar(7)= null,
@CustomerName varchar(30)= null,
@AddressLine1 varchar(30)= null,
@AddressLine2 varchar(30)= null,
@AddressLine3 varchar(30)= null,
@City varchar(20)= null,
@State varchar(2)= null,
@ZipCode varchar(10)= null,
@CountryCode varchar(3)= null,
@SalesPersonCode varchar(4)=null,
@EmailAddress varchar(50)= null,
@URLAddress varchar(50)= null,
@CreditLimit dec(19,7)= null,
@AccountId uniqueidentifier,
@FaxNumber varchar(17)= null,
@PhoneNumber varchar(17) = null,
@ContactCode varchar(10)= null,
@TermsCode varchar(2)= null
AS
BEGIN
INSERT INTO [MAS_001].[dbo].[AR1_CustomerMaster]
SELECT
@Division,
@CustomerNumber,
@CustomerName,
@AddressLine1,
@AddressLine2,
@AddressLine3,
@City,
@State,
@ZipCode,
@CountryCode,
@SalesPersonCode,
@EmailAddress,
@URLAddress,
@CreditLimit,
@AccountId,
@FaxNumber,
@PhoneNumber,
@ContactCode,
@TermsCode
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
**************************************************
Server: Msg 213, Level 16, State 4, Procedure p_insertCustomer, Line 23
Insert Error: Column name or number of supplied values does not match table definition.
**************************************************
I have checked the syntax and I have checked and ensured all things exist in the table, I am at a loss. Please help.
**************************************************
IF exists(
SELECT * from SysObjects where name = 'p_insertCustomer' and type='P'
)
BEGIN
drop proc p_insertCustomer
END
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE p_insertCustomer
@Division varchar(2) = null,
@CustomerNumber varchar(7)= null,
@CustomerName varchar(30)= null,
@AddressLine1 varchar(30)= null,
@AddressLine2 varchar(30)= null,
@AddressLine3 varchar(30)= null,
@City varchar(20)= null,
@State varchar(2)= null,
@ZipCode varchar(10)= null,
@CountryCode varchar(3)= null,
@SalesPersonCode varchar(4)=null,
@EmailAddress varchar(50)= null,
@URLAddress varchar(50)= null,
@CreditLimit dec(19,7)= null,
@AccountId uniqueidentifier,
@FaxNumber varchar(17)= null,
@PhoneNumber varchar(17) = null,
@ContactCode varchar(10)= null,
@TermsCode varchar(2)= null
AS
BEGIN
INSERT INTO [MAS_001].[dbo].[AR1_CustomerMaster]
SELECT
@Division,
@CustomerNumber,
@CustomerName,
@AddressLine1,
@AddressLine2,
@AddressLine3,
@City,
@State,
@ZipCode,
@CountryCode,
@SalesPersonCode,
@EmailAddress,
@URLAddress,
@CreditLimit,
@AccountId,
@FaxNumber,
@PhoneNumber,
@ContactCode,
@TermsCode
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO