selecting mulitiple variable values in a stored procedure

  • I have a stored procedure with 2 output parameters

    @value1

    @value2

    I have a select statement and I want to assign the results to the 2 variables, something like this

    SELECT @value1,@value2 = column1, column2 from table where table.id = @id

    this syntax is incorrect though, how can I achieve this ? Is this even the correct way ?

  • SELECT @value1=column1 ,@value2=column2 from table where table.id = @id

    Don't forget to define the parameters as output in both the stored procedure and the calling script.

  • thanks, that sorted it

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

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