Solved

Can't get 4 part naming to work on as400 link

Posted on 2006-06-16
3
284 Views
Last Modified: 2008-03-17
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_PROD

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.SQLTable 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.
0
Comment
Question by:williak7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 16924761
you can write 2) as ...

select *
from (Select * From OpenQuery(MHAS400,'Select * From QGPL.DLY_PROD')) as A
inner join SQLServer.SQLDBe.DBO.SQLTable as B
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...

0
 

Author Comment

by:williak7
ID: 16925075
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
0
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 500 total points
ID: 16925139
i think qgpl (your library) is actually the owner or schema ....

(a user doesn't normally own ... a table or view in db2... although he can have an alias or synonm defined for a table/view)

you may be able to get

mhas400.mhas400.qgpl.dlt_prod

to work ...

but the second mhas400 need to be the name of the subsystem or instance of DB2/UDB on the AS400...

you need to ask the as400 dba how his system is named internally and what aliases/nicknames he's exposed wants you to use...


btw do you know the version of DB2/UDB you're trying to connect to...  


hth
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question