我可以使用GUID的第一个或最后16个字符,它仍然是唯一的? [英] Can I use the first OR last 16 characters of a Guid and it still be unique?

查看:126
本文介绍了我可以使用GUID的第一个或最后16个字符,它仍然是唯一的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

生成一个唯一的16个字符的关键,作为批次名称,这不需要任何类型的存储(例如独特的计数器)使用。

Generate a unique 16-character key, to use as a batch name, that doesn't require any type of storage (e.g. a unique counter).

我有一个运行Windows服务的每30秒。我拿起关闭的消息在MQ,并在间歇处理它们。其中的服务呼叫我在做现在需要16个字符的批次名称。 他们不在乎批次名称是什么,它只是需要在所有批次是唯一的。

I have a Windows service that runs every 30 seconds. I picks up messages off of an MQ and processes them in a batch. One of the service calls I'm making is requiring a 16-character batch name now. They don't care what the batch name is, it just needs to be unique across all batches.

如果我生成一个 的Guid ,我可以使用该字符串的第一个或最后16个字符,它仍然是唯一适合我的需要?

If I generate a Guid, can I use the first or last 16 characters of that string and it still be unique for my needs?

推荐答案

没有是简单的答案。为什么不使用的日期/时间?

No is the simple answer. Why not use the date/time?

例如,这里的一些Oracle生成的GUID

For example, here's some Oracle generated GUIDs

D71CDF38BB3B6026E0430A9A9A286026
D71CDF38BB3C6026E0430A9A9A286026
D71CDF38BB3D6026E0430A9A9A286026
D71CDF38BB3E6026E0430A9A9A286026
D71CDF38BB3F6026E0430A9A9A286026
D71CDF38BB406026E0430A9A9A286026

这篇关于我可以使用GUID的第一个或最后16个字符,它仍然是唯一的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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