I need to create a character field with some rules, they are,
Rules: Contract Number
- Contract number must be alphanumeric.
- Contract number must be unique.
- Contract number must be auto increment.
Here, the contract number represents the following terms,
CBE 27 03 2014 001
- CBE - (Coimbatore) City Name.
- 27032014 - Date Month Year.
- 001 - Contract reference number (just numeric value).
My database contract table as follows,
create table contract ( contract_id int not null auto_increment, contract_number char(14) not null, ................ unique key(contract_number), primary key(contract_id) );
This is completely new to me,
- How to implement this task?
- Is there any general logic to implement such kind of tasks?
- Any suggestions to split the big task into smaller tasks, so that it will easy to understand?