IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[pub_new_dbconnection]') AND type = 'P')
DROP PROCEDURE [dbo].[pub_new_dbconnection]
GO
create procedure [dbo].[pub_new_dbconnection]   
@cmpid int 
as  
begin  
    set nocount on   
declare @dcid bigint
insert into ebs_kernel..pub_dbconnection
(dc_cmpid,dc_name,dc_connectionurl,dc_username,dc_password,dc_dbtype)
values(@cmpid,'','','','','');

select top 1 @dcid = dc_id from ebs_kernel..pub_dbconnection
where dc_cmpid = @cmpid and dc_name = '' and 
  dc_connectionurl = '' and dc_username = '' and 
  dc_password = '' and  dc_dbtype = ''
  
select * from  ebs_kernel..pub_dbconnection where dc_id = @dcid 

set nocount off  
end