
DROP TABLE IF EXISTS p30_common.d_crm_contact;
CREATE TABLE IF NOT EXISTS p30_common.d_crm_contact (
	 crm_contact_account  VARCHAR(20) 
	, company_name  VARCHAR(50) 
	, account_name  VARCHAR(50) 
	, owner_id  VARCHAR(30) 
	, full_name  VARCHAR(50) 
	, mobile_phone  VARCHAR(20) 
	, mobile_phone_data_ind  char(1) 
	, mobile_phone_availabilty  char(1) 
	, email  VARCHAR(50) 
	, email_data_ind  char(1) 
	, eamil_availabilty  char(1) 
	, cust_dept  VARCHAR(50) 
	, cust_title  VARCHAR(50) 
	, job_function  VARCHAR(50) 
	, suffix_info  VARCHAR(50) 
	, address_detail  VARCHAR(50) 
	, city_name  VARCHAR(20) 
	, prov_name  VARCHAR(20) 
	, post_cd  VARCHAR(20) 
	, country_name  VARCHAR(20) 
	, ccp_app  VARCHAR(200) 
	, product_interst  VARCHAR(200) 
	, acq_time  timestamp(0) 
	, active_leads_count  int4 
	, app_count  int4 
	, ccp_record_count  int4 
	, gen_product_interst_count  int4 
	, sub_app_count  int4 
	, acq_campaign_name  VARCHAR(200) 
	, create_time  timestamp(0) 
	, create_person  VARCHAR(50) 
	, modify_time  timestamp(0) 
	, modify_person  VARCHAR(50) 
	, industry  VARCHAR(50) 
	, sub_industry  VARCHAR(50) 
	, msr_visibility  VARCHAR(20) 
	, privacy_policy_ind  VARCHAR(20) 
	, contact_score  int4 
	, contact_stage  VARCHAR(50) 
	, contact_type  VARCHAR(20) 
	, collect_personal_info_ind  VARCHAR(20) 
	, collect_personal_info_time  timestamp(0) 
	, phone_ind  VARCHAR(20) 
	, bulk_postalmail_ind  VARCHAR(20) 
	, fax_ind  VARCHAR(20) 
	, track_ind  VARCHAR(20) 
	, set_up_ind  VARCHAR(20) 
	, bulk_email_ind  VARCHAR(20) 
	, email_permission_time  timestamp(0) 
	, sms_ind  VARCHAR(20) 
	, sms_permission_time  timestamp(0) 
	, telmarker_permission_time  timestamp(0) 
	, industry_or_application_info  VARCHAR(20) 
	, last_activity  VARCHAR(20) 
	, market_ind  VARCHAR(20) 
	, marketing_consent  VARCHAR(20) 
	, marketing_consent_time  timestamp(0) 
	, state  VARCHAR(20) 
	, Etl_Batch_No  varchar(50) 
	, Etl_First_Dt  timestamp(0) 
	, Etl_Job  varchar(50) 
	, Etl_Proc_Dt  timestamp(0) 
	, Etl_Tx_Dt  timestamp(0) 
	, Src_Sysname  varchar(50) 
	, Src_Table  varchar(50) 
	,primary key( crm_contact_account )
);

 COMMENT ON COLUMN p30_common.d_crm_contact.crm_contact_account IS 'CRM_CONTACT账号'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.company_name IS '公司名称'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.account_name IS '账号名称'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.owner_id IS '责任人'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.full_name IS '姓名'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.mobile_phone IS '手机号'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.mobile_phone_data_ind IS '手机号有数据标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.mobile_phone_availabilty IS '手机号有效标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.email IS '电子邮箱'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.email_data_ind IS '电子邮箱数据标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.eamil_availabilty IS '电子邮箱有效性标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.cust_dept IS '部门'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.cust_title IS '职位'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.job_function IS '工作领域'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.suffix_info IS '附加信息'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.address_detail IS '详细地址'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.city_name IS '城市'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.prov_name IS '省份'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.post_cd IS '邮编'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.country_name IS '国家'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.ccp_app IS 'CCP应用'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.product_interst IS '产品偏好'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.acq_time IS '购买时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.active_leads_count IS '活动线索数'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.app_count IS '应用数'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.ccp_record_count IS 'CCP记录数'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.gen_product_interst_count IS '通用产品偏好数'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.sub_app_count IS '子应用数'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.acq_campaign_name IS '购买项目名'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.create_time IS '创建时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.create_person IS '创建人'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.modify_time IS '修改时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.modify_person IS '修改人'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.industry IS '行业'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.sub_industry IS '子行业'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.msr_visibility IS 'msr关注度'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.privacy_policy_ind IS '隐私政策同意标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.contact_score IS '联系评分'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.contact_stage IS '联系层次'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.contact_type IS '联系类型'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.collect_personal_info_ind IS '个人信息收集标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.collect_personal_info_time IS '个人信息收集时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.phone_ind IS '电话标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.bulk_postalmail_ind IS '群发邮件标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.fax_ind IS '传真标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.track_ind IS '追踪标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.set_up_ind IS '创建标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.bulk_email_ind IS '群发电子邮件标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.email_permission_time IS '电子邮件权限时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.sms_ind IS '短信标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.sms_permission_time IS '短信权限时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.telmarker_permission_time IS '电话营销权限时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.industry_or_application_info IS '行业或应用标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.last_activity IS '最近活跃'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.market_ind IS '市场营销标志'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.marketing_consent IS '营销同意书'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.marketing_consent_time IS '营销同意时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.state IS '状态'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.Etl_Batch_No IS '作业批次号'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.Etl_First_Dt IS '最初入库时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.Etl_Job IS '作业名称'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.Etl_Proc_Dt IS '本次入库时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.Etl_Tx_Dt IS '作业运行时间'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.Src_Sysname IS '来源系统'; 
 COMMENT ON COLUMN p30_common.d_crm_contact.Src_Table IS '来源表'; 

COMMENT ON TABLE p30_common.d_crm_contact IS 'CRM联系方式';