USE [master]
GO
IF  EXISTS (SELECT name FROM sys.databases WHERE name = N'BodDoc')
DROP DATABASE BodDoc;

CREATE DATABASE BodDoc;

--COPY THE TABLES FROM THE ORIGINAL DATABASES TO THE BodDOc DATABASE
SELECT * INTO BodDoc.dbo.BIS_BOD_COLUMN	
FROM InforBISConfig.dbo.BIS_BOD_COLUMN

SELECT * INTO BodDoc.dbo.BIS_BOD_REGISTRATION
FROM InforBISConfig.dbo.BIS_BOD_REGISTRATION

SELECT * INTO BodDoc.dbo.BIS_COLUMN_MAPPING
FROM InforBISConfig.dbo.BIS_COLUMN_MAPPING

SELECT * INTO BodDoc.dbo.BIS_EXPORT_SERVICE
FROM InforBISConfig.dbo.BIS_EXPORT_SERVICE

SELECT * INTO BodDoc.dbo.BIS_EXPORT_SERVICE_OPTION
FROM InforBISConfig.dbo.BIS_EXPORT_SERVICE_OPTION

SELECT * INTO BodDoc.dbo.BIS_EXPORT_SERVICE_PARAMETER
FROM InforBISConfig.dbo.BIS_EXPORT_SERVICE_PARAMETER

SELECT * INTO BodDoc.dbo.BIS_IMPORT_SERVICE
FROM InforBISConfig.dbo.BIS_IMPORT_SERVICE

SELECT * INTO BodDoc.dbo.BIS_OUTPUT_FORMAT
FROM InforBISConfig.dbo.BIS_OUTPUT_FORMAT

SELECT * INTO BodDoc.dbo.BIS_OUTPUT_FORMAT_FIELD
FROM InforBISConfig.dbo.BIS_OUTPUT_FORMAT_FIELD

SELECT * INTO BodDoc.dbo.BIS_OUTPUT_MAPPING
FROM InforBISConfig.dbo.BIS_OUTPUT_MAPPING

SELECT * INTO BodDoc.dbo.BIS_OUTPUT_MAPPING_ENTRY
FROM InforBISConfig.dbo.BIS_OUTPUT_MAPPING_ENTRY

SELECT * INTO BodDoc.dbo.BIS_OUTPUT_VIEW
FROM InforBISConfig.dbo.BIS_OUTPUT_VIEW

SELECT * INTO BodDoc.dbo.BIS_OUTPUT_VIEW_COLUMN
FROM InforBISConfig.dbo.BIS_OUTPUT_VIEW_COLUMN

SELECT * INTO BodDoc.dbo.BIS_SCHEMA_COLUMN
FROM InforBISConfig.dbo.BIS_SCHEMA_COLUMN

SELECT * INTO BodDoc.dbo.BIS_SCHEMA_DEFINITION
FROM InforBISConfig.dbo.BIS_SCHEMA_DEFINITION

SELECT * INTO BodDoc.dbo.RBH_ANALYTIC_CONFIG_GROUP
FROM InforRBHP.dbo.RBH_ANALYTIC_CONFIG_GROUP

SELECT * INTO BodDoc.dbo.RBH_ANALYTIC_CONFIGURATION
FROM InforRBHP.dbo.RBH_ANALYTIC_CONFIGURATION

SELECT * INTO BodDoc.dbo.RBH_ANALYTIC_GROUP
FROM InforRBHP.dbo.RBH_ANALYTIC_GROUP

SELECT * INTO BodDoc.dbo.RBH_BAR_CHART_CONFIGURATION
FROM InforRBHP.dbo.RBH_BAR_CHART_CONFIGURATION

SELECT * INTO BodDoc.dbo.RBH_BAR_CHART_VALUE_SOURCE
FROM InforRBHP.dbo.RBH_BAR_CHART_VALUE_SOURCE

SELECT * INTO BodDoc.dbo.RBH_CHART_CONFIGURATION
FROM InforRBHP.dbo.RBH_CHART_CONFIGURATION

SELECT * INTO BodDoc.dbo.RBH_GAUGE_CHART_CONFIG
FROM InforRBHP.dbo.RBH_GAUGE_CHART_CONFIG

SELECT * INTO BodDoc.dbo.RBH_I18N_ANALYTIC_CONFIG_DET
FROM InforRBHP.dbo.RBH_I18N_ANALYTIC_CONFIG_DET
--WHERE InforRBHP.dbo.RBH_I18N_ANALYTIC_CONFIG_DET.C_LOCALE = 'en_US'

SELECT * INTO BodDoc.dbo.RBH_LINE_CHART_CONFIGURATION
FROM InforRBHP.dbo.RBH_LINE_CHART_CONFIGURATION

SELECT * INTO BodDoc.dbo.RBH_LINE_CHART_VALUE_SOURCE
FROM InforRBHP.dbo.RBH_LINE_CHART_VALUE_SOURCE

SELECT * INTO BodDoc.dbo.RBH_PIE_CHART_CONFIGURATION
FROM InforRBHP.dbo.RBH_PIE_CHART_CONFIGURATION