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!

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.