auto-increment

How to generate a unique text id for a online resource

Hi, I want to generate a unique id which will be used in URLs to identify a specific resource. In principle it is the same as pastebin.com etc. does. The id and resource is not very secret but I want it to be so you just can't decrement a id and then get another users resource. I´m thinking of a CHAR(8) which will look nice in a URL an...

How to set an AUTO_INCREMENT field with to start with the value 6000 in mysql?

How to set a field auto increment without auto increment key in mysql or how set a field auto increment with start value 6000 in mysql? ...

MySQL InnoDB auto_increment value increases by 2 instead of 1. Virus?

There's an InnoDB table for storing comments for blog posts used by a custom built web application. Recently I noticed that the auto incremented primary key values for the comments are incrementing by 2 instead of just 1. I also noticed that in another MySQL table which is used for remembering the last few commenter's footprint signatu...

Auto-incrementing C# container ID

Hey, If I have a list of objects, for example List<Cake>, is it possible to have a private int key in the Cake object that will store an auto-incremented value every time I add to the list. My reason for wanting this is so that I can populate a combobox containing all the "Cakes" in my list with a unique value for each element that I d...

sql update records with incrementing value starting from 1 each time

I am adding batches of records to a table using a single insert statement. I want each new batch to be allocated incrementing numbers, but starting from 1 each time. So, if I have Batch Name IncementingValue 1 Joe 1 1 Pete 2 1 Andy 3 2 Sue 1 2 Mike 2 2 Steve 3 and I ...

Is there a simple way to keep MySQL row ids from growing?

I was wondering what the simplest way of letting a table set ids automatically is, apart from AUTO_INCREMENT. I have a table that will accumulate thousands of rows over a long period of time. Some of these rows will be deleted at a later time. How do I get new rows to get the lowest available id, without getting into doing it manually. ...

How do I update a sequential attribute with foobar#{n} with n incrementing ?

I want to write basically User.find(:all).each {|u| u.update_attribute("email","nil#{incrementing_number}")} How do I make that #{incrementing_number} incremement per updated attribute. :D ...

MySQL stored procedure skips id's when auto incrementing

Hi, I'm having some problems with my stored procedure. Hope anyone can help me figure out what the problem is. I use the data from weekly_schedule as a template for how fill my flight-table. I do this by calling CreateFlights(). All data get inserted as expected, so I'm not missing any data, but for some reason every third row is skippe...

auto_increment usage in composite key

I am having a table with the composite key emp_tbl( companyId int not null, empId int not null auto_increment, name varchar2, .... ... primary key(companyId,empId) ); In mysql whats happening is while i starts inserting the data Emp_tbl companyId empId 1 1 1 2 1 3 2 1 2 ...

JPA: how to make a field auto increment

I use Eclipselink as my JPA provider, how can I make a field auto increment? ...

How do I name my build?

What is the proper way to name my revisions? v1.0.3.20 Alpha or Alpha v1.0.3.20 ...

Update with an incremented value based on corresponding row

Here's a problem for the PHP-juggler in you. I want to use plain-ol' mysql_* functions of PHP. I have the following MySQL table: +-----+-----------------+ | id | thread | +-----+-----------------+ | 14 | 01/ | | 14 | 02/ | | 14 | 03/ | | 15 | 01/ | | 22 | 01/ |...

mysql auto increment primary key id's

How do you look for a delete ID number that has been used, but deleted as is no longer used, before you just append on top of the last ID number that has been added For example: ID Name 1 Orange 5 Apple I have auto increment on, I want to add Banana in to number 2, but auto increment is adding it as ID 6 I'm ...

how to use em.merge() to insert OR update for jpa entities if primary key is generated by database?

I have an JPA entity like this: @Entity @Table(name = "category") public class Category implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false...

How do I view the auto_increment value for a table

The only way I know is show create table MyTable ...

How to change id in existing MySQL tables with data to autoincrement from last highest id?

I have just managed to migrate a pretty big database from SQL Server to MySQL. I didn't set the primary keys to auto increment during the migration because the tables have relationships based on ids as primary keys which are foreign keys in another table. Now for adding new records I want to alter the primary key 'id' columns in all tab...

Auto increment of Concatenated alpha-numeric. (Python)

I have defined a function that generates ID. I need to increment the numbers every time I call the function. So I used max() function to find the last largest value stored in the list. According to the requirements my ID should also consist of a string in front of the integers. So I have concatenated a string with some numbers which ha...