IF NOT EXISTS (
    SELECT * 
    FROM sys.columns 
    WHERE object_id = OBJECT_ID('emp_det') 
    AND name = 'emp_det_cm_due_day'
)
BEGIN
    ALTER TABLE emp_det
    ADD emp_det_cm_due_day numeric(12,0)
END

DELETE	cf_label
WHERE	table_name = 'emp_det'
AND 	column_name = 'emp_det_cm_due_day'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'emp_det', 'emp_det_cm_due_day', 
		'Mobile CM Due Day:', 
		'Mobile CM Due Day:', 
		'Mobile CM Due Day', 
		'Mobile CM Due Day', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO


IF NOT EXISTS (
    SELECT * 
    FROM sys.columns 
    WHERE object_id = OBJECT_ID('emp_det') 
    AND name = 'emp_det_pm_due_day'
)
BEGIN
    ALTER TABLE emp_det
    ADD emp_det_pm_due_day numeric(12,0)
END

DELETE	cf_label
WHERE	table_name = 'emp_det'
AND 	column_name = 'emp_det_pm_due_day'
GO

INSERT 	cf_label (language_cd, table_name, column_name, 
		default_label,
		customize_label, 
		default_header, 
		customize_header, 
		cfr_flag, cf_label_required, audit_user, audit_date ) 
SELECT 	language_cd, 'emp_det', 'emp_det_pm_due_day', 
		'Mobile PM Due Date:', 
		'Mobile PM Due Date:', 
		'Mobile PM Due Date', 
		'Mobile PM Due Date', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

update emp_det set emp_det_cm_due_day = 3 where emp_det_cm_due_day is null
GO
update emp_det set emp_det_pm_due_day = 3 where emp_det_pm_due_day is null
GO
