IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_save_document]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_save_document]
GO
CREATE procedure [dbo].[mps_save_document] 
@doc_id bigint,
@doc_title nvarchar(100),
@doc_abstract nvarchar(200),
@doc_label nvarchar(200),
@doc_similar nvarchar(200),
@doc_security int,
@doc_distroy datetime,
@doc_deliver int,
@doc_attachi int,
@doc_icon1 varchar(200),
@doc_icon2 varchar(500),
@doc_sourceurl varchar(500),
@doc_source nvarchar(100),
@doc_author nvarchar(100) 
as
begin

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
 update mps_document set 
 doc_title = case when @doc_title='_none_' then doc_title else @doc_title end,
 doc_abstract = case when @doc_abstract='_none_' then doc_abstract else @doc_abstract end,
 doc_label = case when @doc_label='_none_' then doc_label else @doc_label end,
 doc_similar = case when @doc_similar='_none_' then doc_similar else @doc_similar end,
 doc_security = case when @doc_security=-999999999 then doc_security else @doc_security end,
 doc_distroy =  @doc_distroy ,
 doc_deliver = case when @doc_deliver=-999999999 then doc_deliver else @doc_deliver end,
 doc_attachi = case when @doc_attachi=-999999999 then doc_attachi else @doc_attachi end,
 doc_icon1 = case when @doc_icon1='_none_' then doc_icon1 else @doc_icon1 end,
 doc_icon2 = case when @doc_icon2='_none_' then doc_icon2 else @doc_icon2 end,
 doc_source = case when @doc_source='_none_' then doc_source else @doc_source end,
 doc_author = case when @doc_author='_none_' then doc_author else @doc_author end,
     doc_sourceurl = case when @doc_sourceurl='_none_' then doc_sourceurl else @doc_sourceurl end,
 doc_archive = 0
 where doc_id = @doc_id
end