Solved

sql i am running the sql line and i am receiving the error below, please advice?

Posted on 2011-09-23
2
199 Views
Last Modified: 2012-05-12
insert into [wf10inani].[dbo].[ivtf] select * from [wf10taa].[dbo].[ivtf] where code = 'FK5067342'

the tables having the same columns
error:
Insert Error: Column name or number of supplied values does not match table definition.
0
Comment
Question by:gvilbis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 36587230
the error is exactly as indicated: the source table has not the same schema as the destination table.
so, instead of using SELECT *, use the list of columns that need to be put into the destination table.

btw, I presume this is MS SQL Server?! [moving the question]
0
 
LVL 2

Assisted Solution

by:marappan
marappan earned 250 total points
ID: 36588029
Your syntax should be:

insert into [wf10inani].[dbo].[ivtf] select COLUMN_NAME1, COLUMN_NAME2 from [wf10taa].[dbo].[ivtf] where code = 'FK5067342'

I assumed that COLUMN_NAME1 and COLUMN_NAME2 are the only columns in  [wf10inani].[dbo].[ivtf]. If you have more columns in  [wf10inani].[dbo].[ivtf] then please add it in the SELECT statment.
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question