• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

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

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
gvilbis
Asked:
gvilbis
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
marappanCommented:
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now