 		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

		insertStatement = 
			'INSERT INTO ' .. string.upper(given_fact_table_name) .. ' (' .. insertSegment .. ', ' .. factTable[3][1] .. ') (SELECT ' .. selectSegment .. ', ' .. factTable[2][1] ..
			' FROM ' .. target_schema .. '.' .. target_table 
	
		local leftJoins = ''

			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
