I'm using this code to insert new record to database:
function newProtocol($date, $type, $text, $who, $reff) {
$sql = "INSERT INTO c_rozhovor (ref_kunde, protokol_typ, besuch_protokol, datum_vzniku, kto_vytvoril) VALUES ('"
.msescape($reff)."','"
.msescape($type)."','"
.msescape($text)."','"
.msescape($date)."','"
.msescape($who)."')";
$connection = odbc_connect(constant('DATABASE_NAME'),'','');
if (!connection) return false;
$query = odbc_exec($connection, $sql);
if (!query) return false;
return "New protocol was successfuly saved!";
}
I would like somehow to return last inserted id instead of New protocol was successfully saved!
string. Something like LAST_INSERT_ID()
in MySql. Is there a way to achieve that in SQL Server 2000?