Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Insert Query with auto-incrementing key

 
Chris Weathers
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a users table with a primary key "id" that is set to auto-increment for new insertions. So a new user gets automatically assigned the number of users + 1 for their id.

How does my query from my jsp change in this situation? Do I just leave off the "id" field in the Insert query?
 
Samuel Cox
Ranch Hand
Posts: 96
Scala Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For oracle, mysql, sqlserver, db2?

For db2, I think we used identity_val_local or something like that. For sqlserver, you leave it off.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic