williak7
asked on
Can't get 4 part naming to work on as400 link
I have a two part question:
1) I have an as400 linked through my sqlexpress 2005. I am successfull in quering the database using this statement:
Select * From OpenQuery(MHAS400,'Select * From QGPL.DLY_PROD')
However, I would like to use the four part naming. I am using this statement, but not sure what to use for the QSECOFR.
select * from MHAS400.QGPL.QSECOFR.DLY_P ROD
MHAS400 -linked server
QGPL - library
QSECOFR - user with acces to library (this is where I am not sure I have the correct info)
DLY_PROD- file/table
So what is the 3rd section of the 4 part naming convention?
2) And will I be able to accomplish my goal pulling data from both the AS400 and SQL in the same statement similiar to this...
select * from MHAS400.QGPL.??.DLY_PROD as A
inner join SQLServer.SQLDBe.DBO.SQLTa ble as B on B.USADATE = A.USADATE
and retrieve data from both server much like querying two sql servers?
Thanks for the help on this.
1) I have an as400 linked through my sqlexpress 2005. I am successfull in quering the database using this statement:
Select * From OpenQuery(MHAS400,'Select * From QGPL.DLY_PROD')
However, I would like to use the four part naming. I am using this statement, but not sure what to use for the QSECOFR.
select * from MHAS400.QGPL.QSECOFR.DLY_P
MHAS400 -linked server
QGPL - library
QSECOFR - user with acces to library (this is where I am not sure I have the correct info)
DLY_PROD- file/table
So what is the 3rd section of the 4 part naming convention?
2) And will I be able to accomplish my goal pulling data from both the AS400 and SQL in the same statement similiar to this...
select * from MHAS400.QGPL.??.DLY_PROD as A
inner join SQLServer.SQLDBe.DBO.SQLTa
and retrieve data from both server much like querying two sql servers?
Thanks for the help on this.
ASKER
I tried qsecofr, but that didn't work. The ?? were to represent the fact that I didn't know what went there. I also tried a number of user id's that have access to the db. I have seen where the 3rd part was respresented as dbo or schema, but I am not familiar enough with as400/db2 to know what that would be.
i did get your response to work. I will see if my first part gets answered and post the points.
kevin
i did get your response to work. I will see if my first part gets answered and post the points.
kevin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
select *
from (Select * From OpenQuery(MHAS400,'Select * From QGPL.DLY_PROD')) as A
inner join SQLServer.SQLDBe.DBO.SQLTa
on B.USADATE = A.USADATE
for 1) since you don't specify qsecfor in the openquery... i'm not sure what you're trying to achieve...