EXECUTING A STRING (URGENT HELP PLEASE)

  • Dear friends,

    i have a problem here that as much as i go through it looks worth.

    I have build a dynamic query with a string like below:

    CREATE PROCEDURE PROC1

    AS

    DECLARE @TempQString nvarchar(1000)

    SET @TempQString = 'DECLARE @resultvalue int'

    SET @TempQString =@TempQString + 'EXEC @resultvalue=[MyStoredProcedure]'

    EXEC sp_executesql @TempQString

    GO

    now in the body of my main stored procedure (PROC1) i want to get the

    return value if the [MyStoredProcedure] that was executed through a string!!!!!!!!!!

    i've tried to insert the return value in a temp table (#table)

    but this also didnt work, cuz out of the string execution my temp table was dropped!! also i cant use a global temp table (##table)

    because many users may execute the PROC1 at the same time!!

    [red]PLEASE HELP THIS IS VERY IMPORTANT FOR ME[/red]

  • Hossein,

    sp_executesql supports output parameters, see BOL.

    Jan

  • Thanks for your Help Jan,

    Wish best Stored Procedures For You,

    Hossein.

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

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