sql server - SQL Column name or number of supplied values does not match table definition -


i'm getting error when try run stored procedure, have checked inserts matches select, seemed issue of time question asked. far can tell match else must wrong.

thanks in advance

error:

msg 213, level 16, state 1, procedure system_increasecustomtariffs, line 36
column name or number of supplied values not match table definition.

code:

--this sp used dorateincrease.exe alter procedure [dbo].[system_increasecustomtariffs]             @increase money,             @programtype varchar(30),             @startdate varchar(10) = null,             @stopdate varchar(10) = null,             @exclude varchar(1024) = ''      set nocount on     declare @oldfreightid int, @custfreightid int, @billacct int, @user varchar(30)     set @user = 'increase_' + replace(convert(varchar(10), getdate(), 101),'/', '-')     --delete existing tariffs    declare c1 cursor          select custfreightid          custfreightprogrammaster          programtype = @programtype , createusr = @user     open c1    fetch next c1 @custfreightid     while (@@fetch_status = 0)      begin        execute delete_custfreightprogrammaster @custfreightid = @custfreightid         fetch next c1 @custfreightid    end     close c1    deallocate c1     --load exclusion table    create table #exclude (parsevalue varchar(100))     insert #exclude        select *         dbo.parse (@exclude, ',')        isnull(parsevalue,'') <> ''  --get active tariffs declare increase cursor      select custfreightid, billacct custfreightprogrammaster         programtype = @programtype           , convert(varchar(10), getdate(), 101) between startdate , stopdate  open increase fetch next increase @oldfreightid, @billacct while (@@fetch_status = 0)   begin     --if billacct excluded increase extend stop date     if exists (select * #exclude cast(parsevalue int)= @billacct)     begin         --extend existing tariff new stop date         update custfreightprogrammaster             set stopdate = @stopdate             custfreightid = @oldfreightid     end      --create new tariff     else     begin         --expire existing tariff 1 day prior start on new tariff         update custfreightprogrammaster             set stopdate = dateadd(day, -1, @startdate)             custfreightid = @oldfreightid          --create new program master         insert custfreightprogrammaster(billacct, programtype, bidirect, startdate, stopdate,                  absoluteminimum, maxdiscount, maxpalletweight, createsvr, createtrm, createusr, createdt)             select billacct, programtype, bidirect, @startdate, @stopdate, absoluteminimum,                  maxdiscount, maxpalletweight, createsvr, createtrm, @user, getdate()             custfreightprogrammaster custfreightid = @oldfreightid           --get new freightid         set @custfreightid = 0         set @custfreightid = scope_identity()          if isnull(@custfreightid,0) = 0         begin             raiserror('tariff not created.',16,1)             return         end          --copy origin zones         insert custfreightprogramoriginzones (custfreightid, zoneid, createsvr, createtrm, createusr, createdt)             select @custfreightid, zoneid, createsvr, createtrm, @user, getdate()              custfreightprogramoriginzones custfreightid = @oldfreightid          --copy destination zones         insert custfreightprogramdestzones (custfreightid, zoneid, createsvr, createtrm, createusr, createdt)             select @custfreightid, zoneid, createsvr, createtrm, @user, getdate()              custfreightprogramdestzones custfreightid = @oldfreightid          --update customer program master program description         update custfreightprogrammaster             set programdesc = dbo.buildcustfreightprogramdesc(custfreightid)             custfreightid = @custfreightid          --copy weight breaks, apply increase         insert custfreightprogramweightbreaks (custfreightid, lowvalue, highvalue, unitcost, createsvr, createtrm, createusr, createdt)             select @custfreightid, lowvalue, highvalue, dbo.increaseunitcost(@programtype, unitcost, @increase), createsvr, createtrm, @user, getdate()              custfreightprogramweightbreaks custfreightid = @oldfreightid          --copy pallet breaks, apply increase         insert custfreightprogrampalletrates (custfreightid, lowvalue, highvalue, unitcost, createsvr, createtrm, createusr, createdt)                 select @custfreightid, lowvalue, highvalue, dbo.increaseunitcost(@programtype, unitcost, @increase), createsvr, createtrm, @user, getdate()              custfreightprogrampalletrates custfreightid = @oldfreightid     end      fetch next increase @oldfreightid, @billacct end  close increase deallocate increase   --clean drop table #exclude 

looks problem here:

insert #exclude     select * dbo.parse (@exclude, ',')         isnull(parsevalue,'') <> '' 

maybe rather make it:

insert #exclude     select [value - or name of first column] dbo.parse (@exclude, ',')         isnull(parsevalue,'') <> '' 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -