Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    Birmingham, UK
    Posts
    121

    Unanswered: Return a resultset from a Stored Pro

    Hello all,
    I want to be able to be able to return a resultset from a Stored Procedure.

    Something like :

    CREATE PROCEDURE LSNOnAJob
    @MyJobNo AS INT,@MyLsn VarChar(10) OUTPUT

    AS

    SELECT @MyLsn = dbo.TSample.ISmpShortCode
    FROM dbo.TJob INNER JOIN
    dbo.TSample ON dbo.TJob.IJobN = dbo.TSample.IJobN
    WHERE (dbo.TJob.IJobN = @MyJobNo)
    GO

    I pass the IJobN into the Sproc and it should give me a resultset back that contains 5 Ismpshortcode's (which is the resultset I want to pass back to Access XP). But the value that gets returned is the last result from the recordset.

    I'm obviously doing something a bit stupid, so any help would be greatly appreicitated.

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    would this work for you or do you need the results returned in an output variable?

    CREATE PROCEDURE LSNOnAJob
    @MyJobNo AS INT
    --,@MyLsn VarChar(10) OUTPUT

    AS

    SELECT dbo.TSample.ISmpShortCode
    FROM dbo.TJob INNER JOIN
    dbo.TSample ON dbo.TJob.IJobN = dbo.TSample.IJobN
    WHERE dbo.TJob.IJobN = @MyJobNo
    GO
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Sep 2003
    Location
    Birmingham, UK
    Posts
    121
    I need the results returned back to an Access DB

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Just use a pass through query and EXEC the sproc....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •