Sunday, March 11, 2012

AS400 to SQL with different MEMBER name


I have been trying to transfer some data from a file located in a AS400 Server to SQL , but the file has more than one Member Name. I'm not sure how to specify a different member name on the SQL query . Please help.

The name of the file is:

Library = MTGLIBP2

File Name = CHSAVQPL

Member Name = INS

this is the query I have so far but I still need to reference the Member Name

SELECT *
FROM OPENQUERY(AS400PL,'SELECT * FROM mtglibp2.CHSAVQPL')


I have been trying to transfer some data from a file located in a AS400 Server to SQL , but the file has more than one Member Name. I'm not sure how to specify a different member name on the SQL query . Please help.

The name of the file is:

Library = MTGLIBP2

File Name = CHSAVQPL

Member Name = INS

this is the query I have so far but I still need to reference the Member Name

SELECT *
FROM OPENQUERY(AS400PL,'SELECT * FROM mtglibp2.CHSAVQPL')

I found the solution to my problem. I needed to use SQL Enterprise Manager to set up a DTS Package.

The first step is to link AS400 server and SQL, then set up the first query using AS400 and create an alias for the file I needed to use.

example: CREATE ALIAS qgpl.mydata FOR mtglibp2.chsavqpl (INS) the INS is the Member I need to use.

The second step is to transfer the data to SQL by using the following query :

SELECT * INTO MYTABLE

FROM OPENQUERY (AS400PL,'SELECT * FROM QGPL.MYDATA') -- (This will transfer only the data with the Member Name specifiedd)

I hope this helps. : )

No comments:

Post a Comment