March 1, 2012 at 7:26 pm
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
March 1, 2012 at 7:39 pm
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.
March 1, 2012 at 7:53 pm
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply