CREATE PROCEDURE [dbo].[create_insert_dim_customer_relationship]
AS
BEGIN
    DROP TABLE IF EXISTS dim_customer_relationship;
    create table dim_customer_relationship
    (
        id int identity,
        relationship_value int unique,
        title varchar(255),
        description varchar(255) null,
    );
    create index dim_customer_relationship_relationship_value_index
        on dim_customer_relationship (relationship_value);
    INSERT INTO dim_customer_relationship (relationship_value, title) VALUES (0, 'Active clients');
    INSERT INTO dim_customer_relationship (relationship_value, title)
    SELECT relationship_id, relationship_title
    from
         mis_customer_accounts_relationship_master ;
    UPDATE last_updated_at_history set last_updated_at = getdate() where sp_name = 'create_insert_dim_client_grade_master';


END;
go

