Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Insert Error: Column name or number of supplied values does

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-11 : 08:12:46
Mike writes "I'm running this stored procedure that does an UPDATE. I'm getting a so-called Insert Error:

Insert Error: Column name or number of supplied values does not match table definition.

when running it in Query Analyzer as thus:

dbo.sp_u_tracking_loan 171,82,'Indirect',0,187,NULL,'12-345678-9','','NA','dmartin',0,'1/2/2006','1/3/2006','micaza'


...this makes no sense to me.

Thanks for any help

here's the stored proc:

CREATE PROCEDURE dbo.sp_u_tracking_loan
@Loan_ID int,
@loan_type_id int = NULL,
@loan_origin varchar(20) = NULL,
@loan_tpv_id int = NULL,
@loan_relationship_id int = NULL,
@loan_application_number varchar(50) = NULL,
@Loan_File_Number varchar(50) = NULL,
@loan_processor_id varchar(20) = NULL,
@loan_credit_analyst_id varchar(20) = NULL,
@loan_officer_id varchar(20) = NULL,
@loan_closing_tpv_id int = NULL,
@loan_lo_given_date datetime='01/01/1900',
@loan_ca_given_date datetime='01/01/1900',
@user_id varchar(20) = NULL --the user updating
AS

BEGIN

SET NOCOUNT ON

DECLARE @errorsproc varchar(100)
SET @errorsproc = OBJECT_NAME(@@procid)
DECLARE @errormsgid int

/*** UPDATE LOAN ***/
IF @loan_lo_given_date='12:00:00 AM'
SET @loan_lo_given_date='01/01/1900'
IF @loan_ca_given_date='12:00:00 AM'
SET @loan_ca_given_date='01/01/1900'


BEGIN TRANSACTION upd_loan
SAVE TRANSACTION upd_loan

BEGIN
UPDATE tbl_loan SET
loan_type_id=@loan_type_id,
loan_origin=@loan_origin,
loan_tpv_id=@loan_tpv_id,
loan_relationship_id=@loan_relationship_id,
loan_application_number=@loan_application_number,
Loan_File_Number=@Loan_File_Number,
loan_administrator_id=@loan_processor_id,
loan_underwriter_id=@loan_credit_analyst_id,
loan_officer_id=@loan_officer_id,
loan_closing_tpv_id=@loan_closing_tpv_id,
modified_by=@user_id,
modified_date=Getdate(),
loan_lo_given_date= CASE
WHEN convert(datetime,@loan_lo_given_date) = '01/01/1900' THEN convert(datetime,loan_lo_given_date)
ELSE convert(datetime, @loan_lo_given_date)
END,
loan_ca_given_date=CASE
WHEN convert(datetime,@loan_ca_given_date) = '01/01/1900' THEN convert(datetime,loan_ca_given_date)
ELSE convert(datetime, @loan_ca_given_date)
END
WHERE loan_id = @loan_id
END
END
GO"

Kristen
Test

22859 Posts

Posted - 2006-01-11 : 12:26:16
Is there an UPDATE trigger on the "tbl_loan" table which is trying to do an Insert? Perhaps into an Audit table?

(If you run the command in Query Analyser you will see that the Insert Error will specify the line number in the source code, which will identify if its in the SProc itself, or the name of the trigger etc. otherwise)

Kristen
Go to Top of Page
   

- Advertisement -