First cut of changes ready for testing for Microsoft SQL Server.  The
only difference I spotted was the use of the "deallocate curs" statement.