SQL query of multi-member file on AS400

前端 未结 4 749
渐次进展
渐次进展 2020-12-28 18:16

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.

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-28 18:31

    You can create an alias using the create alias command:

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

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

    SELECT * FROM myLibrary/myAlias
    

    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

提交回复
热议问题