

/****** Object:  Table [dbo].[dept_mst]    Script Date: 18/12/2023 10:06:46 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[dept_mst](
	[site_cd] [varchar](4) NOT NULL,
	[dept_mst_dept_cod] [varchar](50) NULL,
	[dept_mst_description] [varchar](255) NULL,
	[dept_mst_email_id] [varchar](50) NULL,
	[dept_mst_disable_flag] [varchar](1) NULL,
	[audit_user] [varchar](50) NULL,
	[audit_date] [datetime] NOT NULL,
	[column1] [varchar](60) NULL,
	[column2] [varchar](60) NULL,
	[column3] [varchar](60) NULL,
	[column4] [varchar](60) NULL,
	[column5] [varchar](60) NULL,
	[RowID] [numeric](12, 0) IDENTITY(1,1) NOT NULL,
	[mbl_audit_user] [varchar](50) NULL,
	[mbl_audit_date] [datetime] NULL
) ON [PRIMARY]
GO


GRANT SELECT, INSERT, UPDATE, DELETE
ON dept_mst
TO cmms_user
GO

DELETE	cf_table
WHERE	table_name = 'dept_mst'
GO

INSERT	cf_table (	table_name,           
					table_desc,
					custom_report,
					audit_user,
					audit_date )
VALUES (			'dept_mst',
					'Department Master',
					'0',
					'user',
					GETDATE())
GO

DELETE	cf_label
WHERE	table_name = 'dept_mst'
AND 	column_name = 'dept_mst_dept_cod'
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, 'dept_mst', 'dept_mst_dept_cod', 
		'Department:', 
		'Department:', 
		'Department', 
		'Department', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO


DELETE	cf_label
WHERE	table_name = 'dept_mst'
AND 	column_name = 'dept_mst_description'
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, 'dept_mst', 'dept_mst_description', 
		'Department Name:', 
		'Department Name:', 
		'Department Name', 
		'Department Name', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

DELETE	cf_label
WHERE	table_name = 'dept_mst'
AND 	column_name = 'dept_mst_email_id'
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, 'dept_mst', 'dept_mst_email_id', 
		'Department Email:', 
		'Department Email:', 
		'Department Email', 
		'Department Email', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

DELETE	cf_label
WHERE	table_name = 'dept_mst'
AND 	column_name = 'dept_mst_disable_flag'
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, 'dept_mst', 'dept_mst_disable_flag', 
		'Disable?:', 
		'Disable?:', 
		'Disable?', 
		'Disable?', 
		'0', '0', 'admin', getdate() 
FROM	cf_language 
GO

