 		local dimCreateStatements = {}
 		
 		for a = 1, #dimensions do
-			local str = 'CREATE OR REPLACE TABLE ' .. dimensions[a][1] .. ' (' .. dimensions[a][3] .. ' DECIMAL(10,0) IDENTITY, ' .. dimensions[a][2] .. ', PRIMARY KEY(' .. dimensions[a][3] ..'))'
+			local str = 'CREATE OR REPLACE TABLE ' .. target_schema .. '.' .. dimensions[a][1] .. ' (' .. dimensions[a][3] .. ' DECIMAL(10,0) IDENTITY, ' .. dimensions[a][2] .. ', PRIMARY KEY(' .. dimensions[a][3] ..'));'
 			dimCreateStatements[#dimCreateStatements+1] = {str}
 		end
 		return dimCreateStatements

		end

		for b = 1, #columns do
			insertStatement[#insertStatement+1] = {'INSERT INTO ' .. columns[b][1] .. '(' .. columns[b][2] .. ') (SELECT DISTINCT ' .. columns[b][2] .. ' FROM ' .. target_schema .. '.' .. target_table .. ' WHERE NOT EXISTS (SELECT 1 FROM ' .. columns[b][1] .. ' WHERE (' .. columns[b][3] .. ')))'}
		end
		
		return insertStatement

			target_table .. '.' .. factTableIndividualColumns[c][2] .. ' IS NULL))'
		end
		
		insertStatement = insertStatement .. leftJoins .. ' WHERE NOT EXISTS (SELECT 1 FROM ' .. given_fact_table_name .. ' WHERE (' .. whereClauseKeyComparator .. ') AND (' .. whereNotExistsClause .. ')));'
		
		return insertStatement
	end
