IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_save_manage_grade]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_save_manage_grade]
GO


CREATE procedure [dbo].[mps_save_manage_grade]
-- Add the parameters for the stored procedure here
@mg_id int,
@mg_grade int,
@mg_caption nvarchar(100)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
    -- Insert statements for procedure here
UPDATE mps_manage_grade SET
mg_grade = CASE WHEN @mg_grade = -999999999 THEN mg_grade ELSE @mg_grade END,
mg_caption = CASE WHEN @mg_caption = '_none_' THEN mg_caption ELSE @mg_caption END
WHERE mg_id = @mg_id
SELECT 0 NONE WHERE 0=1
END