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


CREATE procedure [dbo].[mps_save_profession_grade]
-- Add the parameters for the stored procedure here
@bg_id int,
@bg_grade int,
@bg_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_profession_grade SET
bg_grade = CASE WHEN @bg_grade = -999999999 THEN bg_grade ELSE @bg_grade END,
bg_caption = CASE WHEN @bg_caption = '_none_' THEN bg_caption ELSE @bg_caption END
WHERE bg_id = @bg_id
SELECT 0 NONE WHERE 0=1
END