title: SQL Column name or number of supplied values does not match table definition
body: <p>I'm getting this error when I try to run my stored procedure, I have checked that the inserts matches the select, which seemed to be the issue for most of the time this question is asked. As far as I can tell they match so something else must be wrong. </p>
  
  <p>Thanks in advance</p>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Msg 213, Level 16, State 1, Procedure system_IncreaseCustomTariffs, Line 36<br>
    Column name or number of supplied values does not match table definition.</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>--This sp is used by doRateIncrease.exe
  ALTER PROCEDURE [dbo].[system_IncreaseCustomTariffs]
              @Increase money,
              @ProgramType varchar(30),
              @StartDate varchar(10) = NULL,
              @StopDate varchar(10) = NULL,
              @Exclude varchar(1024) = ''
  AS  
     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 FOR 
          SELECT CustFreightId 
          FROM CustFreightProgramMaster 
          WHERE ProgramType = @ProgramType and CreateUsr = @User
  
     OPEN C1
     FETCH NEXT FROM C1 INTO @CustFreightId
  
     WHILE (@@FETCH_STATUS = 0)  
     BEGIN
         EXECUTE delete_CustFreightProgramMaster @CustFreightId = @CustFreightId
  
         FETCH NEXT FROM C1 INTO @CustFreightId
     END
  
     CLOSE C1
     DEALLOCATE C1
  
     --Load exclusion table
     CREATE TABLE #Exclude (parseValue VARCHAR(100))
  
     INSERT INTO #Exclude
         SELECT * 
         FROM dbo.Parse (@Exclude, ',')
         WHERE IsNull(parseValue,'') &lt;&gt; ''
  
  --Get all active tariffs
  DECLARE Increase CURSOR FOR 
      SELECT CustFreightId, BillAcct FROM CustFreightProgramMaster
          WHERE ProgramType = @ProgramType
            and Convert(varchar(10), GetDate(), 101) Between StartDate and StopDate
  
  OPEN Increase
  FETCH NEXT FROM Increase INTO @OldFreightId, @BillAcct
  WHILE (@@FETCH_STATUS = 0)  
  BEGIN
      --If BillAcct excluded from increase just extend stop date
      IF EXISTS (SELECT * FROM #Exclude WHERE Cast(parseValue as int)= @BillAcct)
      BEGIN
          --Extend existing tariff to new stop date
          UPDATE CustFreightProgramMaster
              SET StopDate = @StopDate
              WHERE CustFreightId = @OldFreightId
      END
  
      --Create new tariff
      ELSE
      BEGIN
          --Expire existing tariff 1 day prior to start on new tariff
          UPDATE CustFreightProgramMaster
              SET StopDate = DateAdd(day, -1, @StartDate)
              WHERE CustFreightId = @OldFreightId
  
          --Create new program master
          INSERT INTO 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()
              FROM CustFreightProgramMaster WHERE 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 INTO CustFreightProgramOriginZones (CustFreightId, ZoneId, CreateSvr, CreateTrm, CreateUsr, CreateDT)
              SELECT @CustFreightId, ZoneId, CreateSvr, CreateTrm, @User, GetDate() 
              FROM CustFreightProgramOriginZones WHERE CustFreightId = @OldFreightId
  
          --Copy Destination Zones
          INSERT INTO CustFreightProgramDestZones (CustFreightId, ZoneId, CreateSvr, CreateTrm, CreateUsr, CreateDT)
              SELECT @CustFreightId, ZoneId, CreateSvr, CreateTrm, @User, GetDate() 
              FROM CustFreightProgramDestZones WHERE CustFreightId = @OldFreightId
  
          --Update Customer Program Master program description
          UPDATE CustFreightProgramMaster
              SET ProgramDesc = dbo.BuildCustFreightProgramDesc(CustFreightId)
              WHERE CustFreightId = @CustFreightId
  
          --Copy weight breaks, apply increase
          INSERT INTO CustFreightProgramWeightBreaks (CustFreightId, LowValue, HighValue, UnitCost, CreateSvr, CreateTrm, CreateUsr, CreateDT)
              SELECT @CustFreightId, LowValue, HighValue, dbo.IncreaseUnitCost(@ProgramType, UnitCost, @Increase), CreateSvr, CreateTrm, @User, GetDate() 
              FROM CustFreightProgramWeightBreaks WHERE CustFreightId = @OldFreightId
  
          --Copy pallet breaks, apply increase
          INSERT INTO CustFreightProgramPalletRates (CustFreightId, LowValue, HighValue, UnitCost, CreateSvr, CreateTrm, CreateUsr, CreateDT)
                  SELECT @CustFreightId, LowValue, HighValue, dbo.IncreaseUnitCost(@ProgramType, UnitCost, @Increase), CreateSvr, CreateTrm, @User, GetDate() 
              FROM CustFreightProgramPalletRates WHERE CustFreightId = @OldFreightId
      END
  
      FETCH NEXT FROM Increase INTO @OldFreightId, @BillAcct
  END
  
  CLOSE Increase
  DEALLOCATE Increase 
  
  --Clean up
  DROP TABLE #Exclude
  </code></pre>