开发者

Auto incrementing primary alphanumeric key

I wish to have my primary key of table like st5000, Now I want to au开发者_运维知识库to increment it..

like for next tuple it increment in this way like st50001,st50002,st5003/ for this I will give default value as st5000..Let me know how to do this without using any function or else. or without using any language to generate first and save it.

I want automatically to do this...using my database.


You need two separate columns, one contains the st and one contains the AUTO_INCREMENT integer. These columns together form your composite primary key. You can concatenate them together at display time.

MySQL does support auto incrementing within groups in a composite primary key like this, but only on MyISAM and BDB tables.

http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜