-- 11-10-2016 BB
--
-- Procedure til CVR i dw_list - 9.5.0

patch_id rp_cvr_#2710

if exists (select 1 from sysobjects
   where id = object_id('geokon.rp_cvr') and type = 'P')
   drop function geokon.rp_cvr;

CREATE function geokon.rp_cvr (
  @site_seq_no numeric(9,0))
returns varchar(10)
begin
  declare @central_company_no varchar(10)
  set @central_company_no =
      (select ind_industry.central_company_no
         from ind_industry
        where ind_industry.site_seq_no = @site_seq_no)
  return(@central_company_no)
end;

GRANT EXECUTE ON geokon.rp_cvr TO PUBLIC;