AS400上多成员文件的SQL查询 [英] SQL query of multi-member file on AS400

查看:261
本文介绍了AS400上多成员文件的SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个5250会话中的交互式SQL中的AS400上,

On AS400 in interactive SQL in a 5250 session,

select * from myfile

只有当我的文件有多个成员时才从一个成员返回行。

returns rows from one member only when myfile has more than one member.

我可以从特定的成员中获取行吗?

How can I get rows from a specific member?

重要提示:最后我想用jt400对JDBC进行此操作,所以我想要一个可以工作的解决方案

Important: in the end I'd like to do this over JDBC with jt400 so really I want a solution that'll work there.

谢谢。

推荐答案

您可以使用创建别名命令:

You can create an alias using the create alias command:

CREATE ALIAS myLibrary/myAlias FOR memberLibrary/memberFile(memberName)

这将允许您使用别名运行sql,与其他任何文件一样:

This will allow you to run sql against that member using the alias like you would any other file:

SELECT * FROM myLibrary/myAlias

记住别名会在你的会话结束后,他们不是暂时的。所以如果您完成后不需要别名,则可以在QTEMP中创建别名,或者在完成后明确删除别名:

Just remember that the alias will stick around after your session, they are not temporary. So if you wont need the alias when you are done, either create the alias in QTEMP or explicitly drop the alias once you are done with it:

DROP ALIAS myLibrary/myAlias

HTH

这篇关于AS400上多成员文件的SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆