Fixed: database not selected error in sql script