Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

758 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

23 Experts available now in Live!

Get 1:1 Help Now