INSERT'ing from SQL Server into DB2

John Lantz

INSERT'ing from SQL Server into DB2
We are trying to use a 4 part name to insert into DB2 from a SQL Server
client.

INSERT INTO M1DB2T.M1DB2T.PACST.PAT_TRAN_DTL(SERIES,
ASOF_DT,DISTRICT_CD,OFFICE_CD,ACTIVITY_CD,ACCOUNT_CD,EDIT_CD,TYPE
_CD,ITEM_VALUE_NR)
VALUES('PACS',200803,'03','01','6407','20000','0','T',1)

The problem is performance. Behind the scenes via a monitor, I can see that
a " select * from "M1DB2T"."PACST"."PAT_TRAN_DTL" FOR FETCH ONLY;" is
being done. The problem is that this is a 7 million row table. Needless to say
the INSERT takes forever because of the SELECT that is being done.

Has anybody tried this? Any solution? I seem to remember before when
trying to do it via an openquery that a suggestion was to put some kind of
WHERE criteria that would not find any rows (eg. where 1=2). But the 4 part
naming syntax does not allow that.

______________________________________________________________________

* IDUG 2009 Denver, CO, USA * May 11-15, 2009 * http://IDUG.ORG/lsNA *
______________________________________________________________________



The IDUG DB2-L Listserv is only part of your membership in IDUG. The DB2-L list archives, FAQ, and delivery preferences are at http://www.idug.org/lsidug under the Listserv tab. While at the site, you can also access the IDUG Online Learning Center, Tech Library and Code Place, see the latest IDUG conference information and much more. If you have not yet signed up for Basic Membership in IDUG, available at no cost, click on Member Services at http://www.idug.org/lsms