Hi Jim,
Without having an example of the SQL, I am limited in knowing what exactly is failing, or have the ability to compare differences after editing and saving.
However, I have encountered something similar in the recent past, and it was related to not having an entry in the UrlRecord table.
Hope this helps,
RJ