下の別のデータからかさばるデータを追加したい。しかし、それはできません。エラーが返されます。しかし、地域は同じです。
declare @hrmtable1 table(musterino int, ekno smallint)
insert into @hrmtable1 (musterino , ekno)
select distinct musterino, ekno
from hareketmuhasebe (nolock)
where islemtarihi >= '20120101'
and isnull(musterino, 0) <> 0
and isnull(musterino, 0) > 9000000
and isnull(ekno,0) <> 0
insert into table1(A,B,C,D,E,. . . . .N)
SELECT DISTINCT
case when ((select count(*) from table1 where musterino=e.musterino) > 0)
then (select top 1 *
from dbo.table1
where musterino = e.musterino
order by ekno desc)
else
(select 100, e.musterino, e.ekno, 0, K, L, M)
from @hrmtable1 e )
end
エラー:
メッセージ 120、レベル 15、状態 1、行 10
INSERT ステートメントの選択リストには、挿入リストよりも少ない項目が含まれています。
SELECT 値の数は、INSERT 列の数と一致する必要があります。