Re: Question about autoincrement ID

2006-03-23 Thread SGreen
[EMAIL PROTECTED] (saf) wrote on 03/23/2006 10:50:10 AM: Hi, I have a question about autoincremend id: If I have an autoincrement id set on my first column field of my table and I have the following entries: 1 3 And then I make a INSERT INTO foobar VALUES(''); , the next field

Re: Question about autoincrement ID

2006-03-23 Thread saf
On Thu, Mar 23, 2006 at 11:04:55AM -0500, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (saf) wrote on 03/23/2006 10:50:10 AM: The short answer is no. The Record #2 already existed. It's current status is deleted. If you had other tables that linked their data to record #2 and you created a

Re: Question about autoincrement ID

2006-03-23 Thread Alec . Cawley
[EMAIL PROTECTED] (saf) wrote on 23/03/2006 16:10:04: On Thu, Mar 23, 2006 at 11:04:55AM -0500, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (saf) wrote on 03/23/2006 10:50:10 AM: The short answer is no. The Record #2 already existed. It's current status is deleted. If you had other

Re: Question about autoincrement ID

2006-03-23 Thread saf
On Thu, Mar 23, 2006 at 04:17:44PM +, [EMAIL PROTECTED] wrote: Lots of ways round this. Instead of deleting records, add a boolean deleted flag. All selects then need to add and deleted = 0. But you can find a (random) deleted row with select id from table where deleted = 1 limit 1. If

Re: Question about autoincrement ID

2006-03-23 Thread Martijn Tonies
So I must do a big SELECT and then check my self every time (for each INSERT), which IDs are free? No, you just ignore deleted IDs. What's the point? Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts:

Re: Question about autoincrement ID

2006-03-23 Thread SGreen
[EMAIL PROTECTED] (saf) wrote on 03/23/2006 11:10:04 AM: On Thu, Mar 23, 2006 at 11:04:55AM -0500, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (saf) wrote on 03/23/2006 10:50:10 AM: The short answer is no. The Record #2 already existed. It's current status is deleted. If you had other

Re: Question about autoincrement ID

2006-03-23 Thread mysql
On Thu, 23 Mar 2006 [EMAIL PROTECTED] wrote: To: saf [EMAIL PROTECTED] From: [EMAIL PROTECTED] Subject: Re: Question about autoincrement ID One important thing to remember: You should not let UI design requirements dictate your DB design. Most developers who design the database just

RE: question on autoincrement

2004-04-01 Thread joe collins
similar-ish to setting your sequence in oracle try this: The create table statement below will start the auto increment at 1 CREATE TABLE TableX ( X_primary_key INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, X_col1 VARCHAR(20) NOT NULL, X_col2 VARCHAR(40) NOT NULL, X_col3 VARCHAR(10) NOT

Re: question on autoincrement

2004-04-01 Thread Victor Pendleton
Try this: When you add an AUTO_INCREMENT column, column values are filled in with sequence numbers for you automatically. For MyISAM tables, you can set the first sequence number by executing SET INSERT_ID=value before ALTER TABLE or by using the AUTO_INCREMENT=value table option. See section