主键如何成为负数?

编程入门 行业动态 更新时间:2024-10-23 12:35:49
本文介绍了主键如何成为负数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好 我决定是否也使用PK作为帐号,发票 号,交易号等等用户将看到相应的 文件。我明白,有时会丢失一个数字,这不是我的目的而不是我想的问题,但它会如何消极? 随机创建的PK自动编号字段是否为负数?任何方式PK, 自动编号,*递增*为负? TIA ron

Hi all I''m deciding whether to use the PK also as an account number, invoice number, transaction number, etc that the user will see for the respective files. I understand that sometimes a number will be missing, which is not a problem for my purposes I don''t think, but how would it be negative? Can randomly created PK autonumber fields be negative? Any way for a PK, autonumbered, *incremented* to be negative? TIA ron

推荐答案

Ron写道: 大家好 我决定是否也将PK用作用户将看到相应文件的帐号,发票号,交易号等。我明白有时候会丢失一个数字,这对我的目的来说不是一个问题我不会想到,但它会怎样消极?可以随机创建PK自动编号字段为负数吗?任何方式PK,自动编号,*递增*为负? Hi all I''m deciding whether to use the PK also as an account number, invoice number, transaction number, etc that the user will see for the respective files. I understand that sometimes a number will be missing, which is not a problem for my purposes I don''t think, but how would it be negative? Can randomly created PK autonumber fields be negative? Any way for a PK, autonumbered, *incremented* to be negative?

Jet确定有可能。甚至有一个技术原因: 二进制表示的高位被解释为 数为负数。 众所周知,自动编号会偶尔发生疯狂的跳跃。你不能 依靠他们稳步攀升。 使用你自己的增量数字并不太难。你必须 将这些表上的所有操作限制在通过你的代码路由(通过 函数调用或通过计算新数字的表格) 假设您有一个表Invoice,PK = invID(long)。在基于此表的表单的 BeforeInsert处理程序中有这个: me!invID = nz(dmax(" invID"," Invoice") ;),0)+1 如果还没有记录,这将产生1,如果 有记录,则产生下一个免费号码。 /> - Bas Cost Budde,荷兰 > www.heuveltop.nl/BasCB/msac_index.html 我更喜欢人工邮件高于自动化,所以在我的地址中 用茶替换队列

With Jet sure it is possible. There is even a technical reason for this: the high order bit of the binary representation is interpreted as the number being negative. Autonumbers are known to make frantic jumps now and then. You cannot rely on them climbing steadily. Using your own incremential number is not too difficult. You must confine all actions on such a table to routes via your code (either via function calls or through forms that do the calculation of the new number) Suppose you have a table Invoice, PK=invID (long). Have this in the BeforeInsert handler of a form based on this table: me!invID=nz(dmax("invID","Invoice"),0)+1 This will yield 1 if there is no record yet, and the next free number if there are records. -- Bas Cost Budde, Holland www.heuveltop.nl/BasCB/msac_index.html I prefer human mail above automated so in my address replace the queue with a tea

Ron写道: Ron wrote: 大家好 我'决定是否也使用PK作为账号 Hi all I''m deciding whether to use the PK also as an account number

不要。只是不要。永远不要使用PK作为跟踪号码用户 看到。始终将PK / FK保留为背景中没有人看到的数字。你总是会遇到这样一种情况,即有人想要为账号申请一个架构,根据他的小脚趾点的方向输入一个新的发票号码 系统,随你。如果您正在阅读使用作为连接列/字段数据的,那么将这些更改应用于以前的记录将成为一个难以处理的过程。如果您使用 a正确规范化方法,则需要更改一个帐号....一次。 - Tim ^ o< /#)Burp-beep,burp-beep,burp-beep? - Quaker Jake / ^^什么是UP,Dittoooooo? - 同上

Don''t. Just don''t. Never use the PK as a tracking number the user sees. Always keep the PK/FK as numbers in the background that nobody sees. You will always eventually run into a situation where someone wants to apply a schema for account numbers, enter a new invoice number system based on the direction his small toe points, whatever. If you''re using as a joining column/field data tht is being read, it becomes a difficult process to apply such changes to previous records. If you use a properly normalized approach, you change an account number....once. -- Tim ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "What''s UP, Dittoooooo?" - Ditto

我同意,我从不使用自动编号,它总是以泪水结束。 Tim Marshall < TI **** @ antarctic.flowerpots>在消息中写道 news:cn ********** @ coranto.ucs.mun.ca ... i agree, I never use the autonumbers, it always ends in tears. "Tim Marshall" <TI****@antarctic.flowerpots> wrote in message news:cn**********@coranto.ucs.mun.ca... Ron写道: Ron wrote: 大家好 我决定是否也将PK用作帐号 Hi all I''m deciding whether to use the PK also as an account number

不要。只是不要。切勿将PK用作用户看到的跟踪号码。始终将PK / FK保留为无人看到的背景中的数字。你总是会遇到某人想要为帐号申请架构的情况,根据他的小脚趾点的方向输入一个新的发票编号系统,无论如何。如果您正在使用正在阅读的联接列/字段数据,那么将这些更改应用于以前的记录将变得很困难。如果您使用正确规范化的方法,则需要更改一个帐号....一次。 - Tim ^ o< / #)打嗝,打嗝,打嗝? - Quaker Jake / ^^什么是UP,Dittoooooo? - Ditto

Don''t. Just don''t. Never use the PK as a tracking number the user sees. Always keep the PK/FK as numbers in the background that nobody sees. You will always eventually run into a situation where someone wants to apply a schema for account numbers, enter a new invoice number system based on the direction his small toe points, whatever. If you''re using as a joining column/field data tht is being read, it becomes a difficult process to apply such changes to previous records. If you use a properly normalized approach, you change an account number....once. -- Tim ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "What''s UP, Dittoooooo?" - Ditto

更多推荐

主键如何成为负数?

本文发布于:2023-11-25 15:41:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630342.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:负数   主键

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!