Changed to OdinMS Format

Modified the SQL to work with OdinMS format.