PDA

View Full Version : sql unique id



ganeshgladish
8th June 2013, 18:53
hi ,
i have created Qt database ...in this database i was use auto increment unique id....but i want to change unique id formate(like stud001,stud002,stud003,.....)..i don't know how to change formate...please provide some sollutions.....

Santosh Reddy
8th June 2013, 23:03
Qt Database does not support such increment patterns, you will need to write some custom logic to track the latest id in the database and then generate the next id.

The solution really depends on what you want, if it is as simple as studxxx, then you can just have a id generator which will concatenate the a fixed string ("stud") with a incremental id, where the latest id is taken from database and is tracked further.

ganeshgladish
9th June 2013, 05:59
thank you reddy,
i understand what u say ...could you please send some sample example ....please