pass variable for row

  • You need to specify the @language parameter as being OUTPUT. In turn, when calling the procedure you have to specify OUTPUT again. No need to provide any value for language when calling, because your procedure only set, but does not use, the variable.

    Eg.

     CREATE PROCEDURE GP @ID NVARCHAR(100),
    
    @language NVARCHAR(100) OUTPUT
    AS

    SELECT @language FROM lkptable WHERE ID = @ID
    GO


    DECLARE @Lang NVARCHAR(100)
    EXECUTE GP 'GP 2', @language= @Lang OUTPUT

    Cheers,

    - Mark


    Cheers,
    - Mark

  • Ahem, I might be missing something, but when you do a

    SELECT @language FROM lkptable WHERE ID = @ID

    and assign @language = 'English' it seems pretty logical to me that you get 'English' back.

    Is ID a unique identifier for the row?

    If so, why not only pass Id to your proc and do

    SELECT * FROM lkptable WHERE ID = @ID

    This should give the whole content of the row

    If there can be the same ID multiple times and you need to select the 'English' one, what about

    SELECT * FROM lkptable WHERE ID = @ID AND language =@language

    HTH

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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