Consolidate sql script