473,796 Members | 2,911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unique Number like GUID

I need to create a unique number like a GUID but all numbers.

Does anyone know of algorithm to do this?

Thanks,

David
Nov 16 '05 #1
5 8367
L.M
Hello,

I'm using a call like this one:

GuidKey = System.Guid.New Guid().ToString ("N");

Yo ucan select the 'format' you want.
L.M

"David Pope" <dp***@nospam.s atx.rr.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.phx.gbl...
I need to create a unique number like a GUID but all numbers.

Does anyone know of algorithm to do this?

Thanks,

David

Nov 16 '05 #2
Unique in what context? Unique at the transaction level, table level or
globally (outside the server)?

There are several options, but if this data is to inserted into a table,
then you will want to consider the storage requirements of the values. A
GUID (ex: 6F9619FF-8B86-D011-B42D-00C04FC964FF) is 32 bytes in alpha-numeric
format and would still require a (8 byte) Big Int if converted to numeric.
If you just need a unique numeric value inserted into a table column, then
an auto incremented integer would be the logical choice.
"David Pope" <dp***@nospam.s atx.rr.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.phx.gbl...
I need to create a unique number like a GUID but all numbers.

Does anyone know of algorithm to do this?

Thanks,

David

Nov 16 '05 #3
Hi David,

I don't know your context, so I don't know whether this method is the best.

So, in addition to the others, let me also suggest using the
RNGCryptoServic eProvider class (in the System.Security .Cryptography
namespace), which derives from the RandomNumberGen erator class.
Eg: (in the context of creating a salt)

byte[] saltInBytes = new byte[8];
RNGCryptoServic eProvider saltGenerator = new RNGCryptoServic eProvider();
saltGenerator.G etBytes(saltInB ytes);
string saltAsString = Convert.ToBase6 4String(saltInB ytes);

HTH,
Rakesh Rajan

"David Pope" wrote:
I need to create a unique number like a GUID but all numbers.

Does anyone know of algorithm to do this?

Thanks,

David

Nov 16 '05 #4
if it is not that frequent how aboout using the current date & time

e.g.

DateTime.Now.Ti cks

HTH

Ollie Riches

"David Pope" <dp***@nospam.s atx.rr.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.phx.gbl...
I need to create a unique number like a GUID but all numbers.

Does anyone know of algorithm to do this?

Thanks,

David

Nov 16 '05 #5
I agree with you.
this is a good way.

I use following:
now.ticks + random number.
Maybe you try to calculate with the MAC Adress.

Joerg

"Ollie Riches" <ol**********@h otmail.com> schrieb im Newsbeitrag
news:OL******** *****@TK2MSFTNG P15.phx.gbl...
if it is not that frequent how aboout using the current date & time

e.g.

DateTime.Now.Ti cks

HTH

Ollie Riches

"David Pope" <dp***@nospam.s atx.rr.com> wrote in message
news:O8******** ******@TK2MSFTN GP09.phx.gbl...
I need to create a unique number like a GUID but all numbers.

Does anyone know of algorithm to do this?

Thanks,

David


Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4485
by: Joe Wong | last post by:
Hi, I need to implement a unique number generator that 1 or more processes on same or different machines will make use of it. Is there any library / project available already for this? Thanks in advance, -- Wong
4
15656
by: Louis Frolio | last post by:
Greetings All, I have read many upon many articles here regarding GUID data types and uniqueness. There have been many opinions regarding the effectiveness of GUID's and when they should/should not be used. However, every article strongly implies, if it does not state it outright, that GUID's are always unique. My question is this, what happens if you have a database that uses GUID's and the NIC is changed out on the box? From what I...
2
1294
by: David Pope | last post by:
I need to create a UNIQUE number similar to a GUID but all numbers. Does anyone know of an algorithm or anything? TIA, Dave
9
11565
by: Bill | last post by:
I need to create a temporary file on the file system. I have over 5000 users What's the best method to ensure uniqueness Thank Bill
6
3063
by: Mullin Yu | last post by:
hi, i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working therefore, i want to have a unique sub directory for each request so as to get rid of any file concurrency issue, e.g c:\working\unique-identifier1 for Request #1 c:\working\unique-identifier1 for Request #2
2
4552
by: Chris Dunaway | last post by:
I have a web service which is accessed by a windows forms application. When the application submits a unit of work (a "job"), I want to return a job receipt or tracking number back to the application. My requirements are these: 1. The receipt number must be unique (like a guid is unique) 2. The receipt must be NON sequential. 3. If possible, I'd like it to be 10 to 12 characters long. 4. If possible, I'd like to include only...
14
2712
by: Chris Dunaway | last post by:
I have used Guid's as a unique identifier in data applications. But in a recent project, the length of the Guid's string is proving to be too long. Is there a method for generating a unique string that is less than the length of a Guid? If I were to take the hash of a Guid string, what is the likelyhood that two different Guids would have the same hash? Can anyone offer any other suggestions?
9
18143
by: Robert Mago | last post by:
Is there a way to create a 10 characthers or less, alph-numeric string which is unique. I can't use the guid since its longer then 10 characthers. Also i cannot use a random number, since being random does not mean that its unique.
16
6939
by: Mark S. | last post by:
I'm a fan of the GUID, but the current project is looking to use a genuinely unique integer. Does the following do that? Math.Abs(System.Guid.NewGuid().GetHashCode()) TIA
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10244
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10201
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.