Fix Incorrect ID in SQLserver

Fixes #5104. I've included @Laykou's proposed changes along with a small tweak to `Table::_insert()` to accommodate SQLserver returning -1 rows when OUTPUT is being used.