Updated to work with SDE in SQL