-- Adding emp_det table assign to control value if 1 then only allow to edit the assign to if 0 then not allow to select the assign to value
IF NOT EXISTS (
    SELECT * 
    FROM sys.columns 
    WHERE object_id = OBJECT_ID('emp_det') 
    AND name = 'emp_det_wo_assign'
)
BEGIN
    ALTER TABLE emp_det
    ADD emp_det_wo_assign varchar(1) NULL
END


DELETE	cf_label
WHERE	table_name = 'emp_det'
AND 	column_name = 'emp_det_wo_assign'
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_wo_assign', 
		'WO Assignment:', 
		'WO Assignment:', 
		'WO Assignment', 
		'WO Assignment', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

update emp_det set emp_det_wo_assign = '1' where emp_det_wo_assign is null
GO
