I know SQL supports an automatic Identity data type. The problem is I have to export my tables from Access to an SQL server on my ISP through MDAC and ODBC. When I do this, the autonumber type in Access is changed to just number on the SQL server. Is there a way I can insert a unique Identity code into new records using SQL statements rather than data types? One solution I thought of is to do something rouqhly along these lines:<br>
"insert into tablename select max(id)+1 from tablename"<br>
<br>
Then I store the ID of the new record in a variable and do an update:<br>
update tablename set a= b= where id=<br>
<br>
Does anybody know if there is a better way to do this? Or if this will work at all?
"insert into tablename select max(id)+1 from tablename"<br>
<br>
Then I store the ID of the new record in a variable and do an update:<br>
update tablename set a= b= where id=<br>
<br>
Does anybody know if there is a better way to do this? Or if this will work at all?