Executing a stored procedure on linked server

  • My linked server is a DB2\Linux. I'm calling a stored procedure on it from SQL Analyzer like this:

    EXEC [DB0004]..[DB2INST1].[SP_ITM_UPDATE_TIME]

    I get the result I expect, which looks like this:

    Boat ID

    0000471008233

    0000471009005

    My problem is that when I try to use INSERT INTO this result into a table the INSERT INTO I get "incorrect syntax". Any ideas?

    Thanks...Nali

  • i believe that the results from a stored procedure must go into an existing table; ie:

    create table #results(boatid varchar(30) ,otherstuff varchar(30))

    insert into #results(boatid)

    EXEC [DB0004]..[DB2INST1].[SP_ITM_UPDATE_TIME]

    that should work;

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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