<?php
include_once('database_connection.php');

$sql="select ROW_NUMBER() over (order by active )+40000 as keyID ,* from Accounts where Under in(260,54,1134,58) and Active=1";
$result=odbc_exec($connection,$sql);
while($row=odbc_fetch_array($result))
{
	$keyID=$row['keyID'];
	$COAID=$row['COAID'];
	echo $sql="update accounts set KeyField='$keyID' where COAID=$COAID";
	odbc_exec($connection,$sql);
}

?>


