Solved

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

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

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now