表格的自定义自动编号ID? [英] Customized Auto-Number IDs for tables?

查看:103
本文介绍了表格的自定义自动编号ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法像自动编号一样在表格中使用自己的编号;即自动将下一个可用记录分配给新记录.我们有我要绑定到该数据库的每个员工的系统ID号.我只希望表格自动分配下一个数字.

Is there a way to use my own number in a table like an auto-number; that is to automatically assign the next available to a new record. We have system ID numbers for each employee that I want to tie into this database. I just want the table to auto assign the next number.

我可以这样做吗?
可以将数字和字母混合使用吗?
是否可以使用准则,例如代码A =某些数字集,代码B =另一个数字集?

Can I do this?
Could this be done with a mixture of numeric and alpha?
Could criteria be used, like Code A = certain set of numbers, Code B = another?

推荐答案

您当然可以,但是您必须自己设计.

Of course you can, but you will have to design this yourself.

执行此操作的方法有数百种,但是一种方法可能是,您可以使用"nextQuote","nextEmployeeNo","nextJob"作为参数表...当然,您的表设计可以包含任何内容,包括前缀示例;

There are hundreds of ways of doing this but one way might be that you may have a parameters table with "nextQuote", "nextEmployeeNo", "nextJob"... of course your table design could have anything, including prefix example;

PARAMETERS
Prefix    Number
Q          1145
E            54
J           999

所以现在您可以SELECT PreFix + MAX(Number) AS NextEmployee FROM Parameters WHERE Prefix = E

在您的代码中,您可以在处理完该数字后增加它.

And in your code you can increment the number after dealing with it.

UPDATE Parameters SET Number = number + 1 WHERE Prefix = E 

如果这不能胜任工作,那么希望它会让您思考如何做类似的事情.

If this isn't up to the job then hopefully it will get you thinking in how you can do something similar.

希望这会有所帮助.

这篇关于表格的自定义自动编号ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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