• 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!