IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_save_title_grade]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_save_title_grade]
GO
CREATE procedure [dbo].[mps_save_title_grade]
-- Add the parameters for the stored procedure here
@tg_id int,
@tg_grade int,
@tg_caption nvarchar(100)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

    -- Insert statements for procedure here
UPDATE mps_title_grade SET
tg_grade = CASE WHEN @tg_grade = -999999999 THEN tg_grade ELSE @tg_grade END,
tg_caption = CASE WHEN @tg_caption = '_none_' THEN tg_caption ELSE @tg_caption END
WHERE tg_id = @tg_id
SELECT 0 NONE WHERE 0=1
END