Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:18:59+00:00 2026-06-13T11:18:59+00:00

I get the following error message with SQL Server 2005 Msg 120, Level 15,

  • 0

I get the following error message with SQL Server 2005

Msg 120, Level 15, State 1, Procedure EPIN, Line 37
The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the
number of INSERT columns.

I have copy and pasted the select list and insert list into excel and verified there are the same number of items in each list. Both tables an additional primary key field with is not listed in either the insert statement or select list. I am not sure if that is relevant, but suspicious it may be.

Here is the source for my stored procedure:

 set ANSI_NULLS ON
 set QUOTED_IDENTIFIER ON
 go

 -- =============================================
 -- Author:     Kristian Manuel
 -- Create date: 10/3/2012
 -- Description:    
 -- =============================================
 ALTER PROCEDURE [dbo].[EPIN] 
-- Add the parameters for the stored procedure here
     @PLUCODE varchar(30),      --Table tblPolicy
     @ECPAYFEES numeric(18,2),
     @COSTPAYABLE numeric(18,2),
     @RETAILPRICE numeric(18,2),
     @DENOMINATION varchar(50),
     @CARDNAME varchar(50),
     @DistributorID varchar(8),
     @AccntID decimal(18,0)

 --PO1  
 AS
 BEGIN
     -- SET NOCOUNT ON added to prevent extra result sets from
     -- interfering with SELECT statements.
     SET NOCOUNT ON;

     INSERT INTO [ECPAY-PC].[GENESIS].[dbo].[tblPolicy]
     ( 
       PolicyID                 ,
       AccountTID               ,
       DistributorID            ,
       CARDNAME                 ,
       DENOMINATION             ,
       RETAILPRICE              ,
       COSTPAYABLE              ,
       ECPAYFEES                ,
       PLUCODE 
     ) 
     SELECT 
         t.* 
     FROM
        (SELECT 
            AccountTID = @AccntID, 
            DistributorID = @DistributorID, 
            CARDNAME = @CARDNAME,      
            DENOMINATION = @DENOMINATION, 
            RETAILPRICE = @RETAILPRICE, 
            COSTPAYABLE = @COSTPAYABLE,      
            ECPAYFEES = @ECPAYFEES, 
            PLUCODE = @PLUCODE) t,
        [ECPAY-PC].[ECPNWEB].[dbo].[account] a
     WHERE
        a.AccntID = t.AccountTID --for account
 END
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:19:00+00:00Added an answer on June 13, 2026 at 11:19 am

    The error message is pretty clear – your INSERT statement expects 9 columns

       1. PolicyID                 
       2. AccountTID               
       3. DistributorID            
       4. CARDNAME                 
       5. DENOMINATION             
       6. RETAILPRICE              
       7. COSTPAYABLE              
       8. ECPAYFEES                
       9. PLUCODE 
    

    to be filled – but your SELECT only provides 8 values

       1. AccountTID               
       2. DistributorID            
       3. CARDNAME                 
       4. DENOMINATION             
       5. RETAILPRICE              
       6. COSTPAYABLE              
       7. ECPAYFEES                
       8. PLUCODE 
    

    It seems you’re not providing any value for the PolicyID column (first column in yoru INSERT) from your SELECT statement…..

    Update: if your PolicyID column in your target table is an “auto-increment” (or IDENTITY) column – then you must not include in in your INSERT statement!

    Just use this:

     INSERT INTO [ECPAY-PC].[GENESIS].[dbo].[tblPolicy]
     (AccountTID, DistributorID, CARDNAME, DENOMINATION,
      RETAILPRICE, COSTPAYABLE, ECPAYFEES, PLUCODE)
    
        SELECT (that provides those 8 values) .... 
    

    If you omit the PolicyID from your INSERT statement, then SQL Server will automatically assign an identity value to it and your INSERT .... SELECT statement will not work since you’re providing 8 values to an INSERT which expects 8 columns…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error message with SQL Server 2005 Msg 120, Level
I wrote following stored procedure in SQL Server 2005 and I get error message:
I get the following error message in SQL Server 2005: User '<username>' does not
if i try to run following code in sql server 2005 i get error
I get following error message, when I try to run git rebase -i for
I get the following error message when I try the following: Dim XL As
when I start GDB, I get the following error message in debugger: input:--- token
Upon launching a sinatra app, I get the following error message: /home/matt/.rvm/gems/ruby-1.9.3-p125/gems/backports-2.5.1/lib/backports/tools.rb:310:in `require': cannot
When I'm uploading a module to Hackage, I get the following error message: Exposed
We get the following error when running at test: ContextSwitchDeadlock was detected Message: The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.