Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2008
    Posts
    24

    Unanswered: Stored proc variable name conflict

    Hello,

    I am modifying a stored procedure to execute another stored procedure.
    The first stored procedure has some variables that I need to pass as input parameters to the second stored procedure. The second stored procedure has a long list of optional input parameters, and only want to pass of them.

    The problem is that the variable names are the same in each stored proc.

    E.g.

    CREATE PROC proc1
    @var1 int,
    @var2 int
    AS
    BEGIN
    /* Do some stuff */
    EXEC proc2 @var1 = /* I need the value of this proc's @var1 here */
    END

    CREATE PROC proc1
    @var1 int ,
    @var2 = NULL,
    etc.

    Is there anyway to resolve the naming conflict without changing the names of the variables in either procedure, as they are widely used elsewhere.

    Thanks, Elizabeth

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    Why do you not use:

    EXEC proc2 @var1, @var2

  3. #3
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    I also tested:

    EXECUTE proc2 @var1 = @var1, @var2 = @var2

    and it works fine.
    (Sybase 15)

  4. #4
    Join Date
    Aug 2008
    Posts
    24
    Thanks, aflorin27.

    The last one would be ideal.
    Didn't work for me, though - Sybase 11 .
    Good to know it'll be an option once we upgrade .

Posting Permissions

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