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 8623665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:20:20+00:00 2026-06-12T07:20:20+00:00

I have the following SQL code: select @colNames = coalesce(@colNames+’,’,”)+””+ RptLOB1 +”” from CM.Correlation

  • 0

I have the following SQL code:

select @colNames = coalesce(@colNames+',','')+''''+ RptLOB1 +''''
from CM.Correlation
group by RptLOB1

print @colNames

insert into AnalyticsV2.dbo.ResultCSV values('', @colNames)

and the print @colNames gives the following:

'Accident and Health','AE','Avemco Aviation','Bail','Commercial','Contingency','Contract','Court','Credit','DFP','DIC','Disability','Energy and Marine','EPLI','Excess Casualty','Exited Lines','Fidelis Marine','Fidelity','Group Life','HC Houston Aviation','HCC Indemnity Guaranty','HCCG International','HCCG US','HCCMIS','HCRM','Indemco','Large Commercial','Liability','Medical Stop Loss','MPL','Niche and Other Specialty','Occupational Accident','Other Aviation','Other International','Other Surety','Other US PC','PI','Primary Casualty','Property DF','Property Treaty','Public Risk','Surety','Technical Property','UK Credit','USSIC Aviation'

45 different RptLOB’s.

When I execute it gives me the following error message:

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

My table has 46 columns and that blank one in the insert statement should adjust for that. Any reason as to why this would give me an error?

Any help will be appreciated!

  • 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-12T07:20:21+00:00Added an answer on June 12, 2026 at 7:20 am

    You are trying to insert 2 values, '' and @colnames on a table that has 46 columns. The fact that @colnames is a string with values separated with commas doesn’t make it as it were 45 columns, its just one string, one column.

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

Sidebar

Related Questions

I have following SQL statementL: select DATE(bla), count(*) from tableA group by DATE(bla) UNION
I have the following SQL code: select val.PersonNo, val.event_time, clg.number_dialed from vicidial_agent_log val join
I have the following SQL code: SELECT eml AS Email Address FROM emailtbl WHERE
i have the following union query sql in my code (SELECT TableA.ID, TableB.Group, ''
I have following SQL code: SELECT m.email FROM members as m WHERE exists (
I have the following SQL: select code, distance from places; The output is below:
I have the following SQL: select code, distance from places; The output is below:
Assuming that I have the following T-SQL code: SELECT * FROM Foo f INNER
I have the following code: SELECT <column>, count(*) FROM <table> GROUP BY <column> HAVING
I have the following code: def add_record(self,values): self.sql.execute(INSERT INTO TEST VALUES (?,?) % values)

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.