Solved

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

Posted on 2011-09-23
2
197 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

829 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