Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

How to create a SP to update multiple fields at once?

How to create a SP to update multiple fields at once?

I have the following code but its not working.

CREATE PROCEDURE [dbo].[edit_notes]

    @COMID INT,
	@visible INT,
    @comments NVARCHAR(MAX),
    @updatedby INT,
    @lastupdate DATETIME,
    @commby BIT,
    @importance INT,
    @visibleemployer BIT
AS
UPDATE dbo.Casecomments
    Set Visible = @visible
    Set Comments = @comments
    Set Updatedby = @updatedby
    Set Lastupdate = @lastupdate
    Set @commby = @commby
    Set @importance = @importance
    Set @visibleemployer = @visibleemployer

WHERE COMMID = @COMID
 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dean Chafee
Dean Chafee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Thanks!