How do I call query on linked AS/400?

  • So I have the ODBC connection set up and working fine between the SQL server and my AS/400. I can query just fine:

    select * from LINKED_SERVER.NAME.LIBRARY.FILE

    What I would like to do now is:

    exec LINKED_SERVER.NAME.LIBRARY.QUERY

  • Here's my super awesome cheaty way to do this easily. I wrote an FTP batch file

    that FTPs into the AS400 and runs the query with:

    quote rcmd runqqry qry(lib/qry)

    The FTP batch file is executed on the SQL 2005 server by use of a stored

    procedure containing the line:

    EXEC master..xp_cmdshell 'ftp -n -s:d:\ftp_scripts\batch.ftp'

    Then I grab the output like normal through use of the linked servers. And viola!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply