由字母和数字组成的ID号将使用哪种类型,并将递增 [英] What type to use for an ID number composed of letters and numbers which will increment

查看:164
本文介绍了由字母和数字组成的ID号将使用哪种类型,并将递增的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用哪种类型来创建由字母和数字组成的ID号,并且该ID号也会递增,例如"HP0001"增加到"HP0002"

What type should I use to create an ID number composed of letters and numbers and which will also increment, e.g. "HP0001" increment to "HP0002"

推荐答案

"X"长度的变量,或2个字段,1个varchar和另一个数字,都必须是主键

Varchar of "X" lenght, or 2 fields, 1 varchar and another numeric, both has to be primary keys

您可以检查本例中我在说什么:

You can check what im talking about in this example:

http://sqlfiddle.com/#!2/df078/4

这篇关于由字母和数字组成的ID号将使用哪种类型,并将递增的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆