Jump to content

adding a prefix to an autogenerated number


nicsnow

Recommended Posts

Hi, I've 'inherited' an sql database that autogenerates a transaction ID for each new entry (a bit like sequential invoice numbers) I need now to place an alpha prefix to the number generated. The current settings are:

Server: localhost  Database: cimnet_new  Table: accomm_main

      Field Type Length/Values1 Attributes Null Default2 Extra

  VARCHAR TINYINT TEXT DATE SMALLINT MEDIUMINT INT BIGINT FLOAT DOUBLE DECIMAL DATETIME TIMESTAMP TIME YEAR CHAR TINYBLOB TINYTEXT BLOB MEDIUMBLOB MEDIUMTEXT LONGBLOB LONGTEXT ENUM SET BOOL      BINARY UNSIGNED UNSIGNED ZEROFILL  not null null  auto_increment 

 

 

I'm a newbie to this caper so any guidance would be greatly appreciated!

 

 

You will be unable to enter anything into an indexed auto-increment column.  You could remove the auto-increment property and have your code provide the info for that column.  You could also add a new column based off of that auto-incremented column and have your code add the alpha prefix.

You will be unable to enter anything into an indexed auto-increment column.  You could remove the auto-increment property and have your code provide the info for that column.  You could also add a new column based off of that auto-incremented column and have your code add the alpha prefix.

 

I second the later option

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.