IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[pub_save_dbconnection]') AND type = 'P')
DROP PROCEDURE [dbo].[pub_save_dbconnection]
GO
create procedure [dbo].[pub_save_dbconnection] 
@dc_id int,
@cmpid int,
@dc_name varchar(255),
@dc_connectionurl varchar(1024),
@dc_username varchar(128),
@dc_password varchar(128),
@dc_dbtype varchar(255)
as
begin
set nocount on
declare @samenum int

select @samenum = count(*) from  ebs_kernel..pub_dbconnection where dc_name = @dc_name and dc_cmpid = @cmpid

if @samenum > 0
begin
select 'error' error,'保存失败！有相同的名称: '+@dc_name  as errorinfo
return 
end else
begin
update ebs_kernel..pub_dbconnection set 
dc_name = case when @dc_name='_none_' then dc_name else @dc_name end,
dc_connectionurl = case when @dc_connectionurl='_none_' then dc_connectionurl else @dc_connectionurl end,
dc_username = case when @dc_username='_none_' then dc_username else @dc_username end,
dc_password = case when @dc_password='_none_' then dc_password else @dc_password end,
dc_dbtype = case when @dc_dbtype='_none_' then dc_dbtype else @dc_dbtype end
where dc_id=@dc_id
end
set nocount off
end