Re: Retrieving correct SERIAL number of new row
Posted in 1997
In article <01bc13fc$ab4a7080$9ce2b8cd@pro>, olpe@ep.com says... >After I insert a row containing a "SERIAL" column, how do I retrieve the >"serial number" of that row (I need to record that number elsewhere). All the responses you've seen so far (I count four) are correct, but if you're using ODBC, you're probably out of luck. There is no current ODBC standard for retrieving the serial number of the most recently inserted row. There is provision for ODBC extensions, but any vendor actually using proprietory extensions (like Intersolv) is (IMO) crazy. (How do I know Intersolv uses proprietory extensions? ODBC Spy on Intersolv controls reports a bunch of SQLGetInfo calls with vendor-specific requests.) The least proprietory response as far as I can think of would be for a vendor to return this number via the SQLError function. Insert a row via ODBC. Check the error status. No error, then check the SQLError function. If it returns a number, that's the serial number you just inserted. That type of thing could work, if it were the standard. If I were only Microsoft... :-) -- William Harris