Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How do I call query on linked AS/400? Expand / Collapse
Author
Message
Posted Wednesday, January 14, 2009 10:48 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, January 18, 2012 10:37 AM
Points: 31, Visits: 133
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

Post #636465
Posted Thursday, January 15, 2009 8:07 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, January 18, 2012 10:37 AM
Points: 31, Visits: 133
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!
Post #637172
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse