Need help of Stored Procedure

  • I've created a stored procedure that will return two values which is department description & remarks.

    Here's my stored procedure code

    Create procedure Get_Dept_Details

    (

    @pcode nvarchar(10),

    @pDesc nvarchar(50) output,

    @pRemarks nvarchar(50) output

    )

    as

    select @pDesc,@pRemarks = description,Remarks from dept where code = @pcode;

    --Error Message

    Msg 141, Level 15, State 1, Procedure Get_Dept_Details, Line 9

    A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.

    Please help me.

    Thanks

    Visual Basic Source Code[/url]
  • Try this:

    Create procedure Get_Dept_Details

    (

    @pCode nvarchar(10),

    @pDesc nvarchar(50) output,

    @pRemarks nvarchar(50) output

    )

    as

    select @pDesc = description,@pRemarks = Remarks from dept where code = @pCode;

    I just moved the columns to get assigned to the vairables.

  • Wow great coldcoffee, it works. You saved my day.

    Again thank you so much.

    Migules

    Visual Basic Source Code[/url]

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

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