nicsnow Posted April 5, 2007 Share Posted April 5, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/45706-adding-a-prefix-to-an-autogenerated-number/ Share on other sites More sharing options...
bwcc Posted April 5, 2007 Share Posted April 5, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/45706-adding-a-prefix-to-an-autogenerated-number/#findComment-222159 Share on other sites More sharing options...
nicsnow Posted April 5, 2007 Author Share Posted April 5, 2007 thanks for that I shall give it a go! Quote Link to comment https://forums.phpfreaks.com/topic/45706-adding-a-prefix-to-an-autogenerated-number/#findComment-222179 Share on other sites More sharing options...
gluck Posted April 5, 2007 Share Posted April 5, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/45706-adding-a-prefix-to-an-autogenerated-number/#findComment-222318 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.