为表定制自动编号 ID?
有没有办法像自动编号一样在表中使用我自己的号码?即自动将下一个可用的记录分配给新记录。我们有每个员工的系统 ID 号,我想将其绑定到该数据库中。我只想让表自动分配下一个数字。
我可以这样做吗?
这可以通过数字和字母的混合来完成吗?
是否可以使用标准,例如代码 A = 某组数字,代码 B = 另一组数字?
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.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当然可以,但是你必须自己设计。
有数百种方法可以做到这一点,但一种方法可能是您可能有一个包含“nextQuote”、“nextEmployeeNo”、“nextJob”的参数表...当然您的表设计可以有任何内容,包括前缀示例;
因此,现在您可以 SELECT PreFix + MAX(Number) AS NextEmployee FROMParameters WHERE Prefix = E
并且在代码中您可以在处理后增加数字。
如果这不能胜任这项工作,那么希望它能让你思考如何做类似的事情。
希望这有帮助。
Of course you can, but you will have to design this yourself.
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;
So now you can
SELECT PreFix + MAX(Number) AS NextEmployee FROM Parameters WHERE Prefix = E
And in your code you can increment the number after dealing with it.
If this isn't up to the job then hopefully it will get you thinking in how you can do something similar.
Hope this helps.
对于 ADO 用户:
如何在 Jet 4.0 中实现多用户自定义计数器
对于 DAO 用户:
如何在 DAO 3.5 中实现多用户自定义计数器
For ADO users:
How To Implement Multiuser Custom Counters in Jet 4.0
For DAO users:
How To Implement Multi-user Custom Counters in DAO 3.5