Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
dummynewbie
Starting Member
4 Posts |
Posted - 2007-04-05 : 08:42:25
|
I'm a newbie and I'm trying to insert data through ODBC in a Microsoft Access Database (the idea is to preserve compatibility with any database, and I activated compatibility with ANSI 92). When I insert one new row (I insert them via a visual c++ mfc program) I'd like to have a new key generated. I tried something like this:INSERT INTO Table1(field1, field2) VALUES((SELECT MAX(value1) FROM Table1)+1, value2);but it doesn't work ("Reserved error (|); there is no message for this error"). Thanks for your help,dummynewbie |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-05 : 08:51:39
|
Use AutoNumber as a data type for the key column.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
dummynewbie
Starting Member
4 Posts |
Posted - 2007-04-05 : 09:13:48
|
Now it works, thank you,dummynewbie |
 |
|
|
|
|