'Number of query values and destination fields are not same' error

  • Thread starter Thread starter ralamo
  • Start date Start date
R

ralamo

When i execute the following insert query, the above mentioned error
is coming. Anything wrong in the query?

INSERT INTO ECN_1 (Old_SbPartNo, Old_PartDesc, Old_ManPartNo,
Old_Manuf, Old_Vendor, Old_RefDesi, Old_Qty,
New_SbPartNo, New_PartDesc, New_ManPartNo,New_Manuf, New_Vendor,
New_RefDesi, New_Qty)
select * from (select SB0014.SbPartNo, SB0014.partDesc,
SB0014.mANpARTnO, SB0014.manufacturer,
SB0014.vendor, sb0014.refdesi, sb0014.qty,
SB0014_2.SbPartNo, SB0014_2.partDesc, SB0014_2.mANpARTnO,
SB0014_2.manufacturer, SB0014_2.vendor,
sb0014_2.refdesi, sb0014_2.qty
from SB0014 LEFT OUTER JOIN SB0014_2
on SB0014.SBPARTNO = SB0014_2.SBPARTNO
where sb0014_2.SbPartNo is null
or sb0014.partDesc <> sb0014_2.partdesc
or sb0014.manpartno <> sb0014_2.manpartno
or sb0014.manufacturer <> sb0014_2.manufacturer
or sb0014.vendor <> sb0014_2.vendor
or sb0014.refdesi <> sb0014_2.refdesi
or sb0014.qty <> sb0014_2.qty
union all
select null, null, null, null, null, null,null,
sb0014_2.SbPartNo, SB0014_2.partDesc, SB0014_2.mANpARTnO,
SB0014_2.manufacturer,
SB0014_2.vendor, sb0014_2.refdesi, sb0014_2.qty
from sb0014
right outer join sb0014_2 on sb0014.SbPartNo = sb0014_2.SbPartNo
where sb0014.SbPartNo is null) as u
 
Make sure that the above number of columns in ECN_1 and u are same
with the datatype

Madhivanan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top