473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 8235
L.M
Hello,

I'm using a call like this one:

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

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

"David Pope" <dp***@nospam.satx.rr.com> wrote in message
news:O8**************@TK2MSFTNGP09.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.satx.rr.com> wrote in message
news:O8**************@TK2MSFTNGP09.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
RNGCryptoServiceProvider class (in the System.Security.Cryptography
namespace), which derives from the RandomNumberGenerator class.
Eg: (in the context of creating a salt)

byte[] saltInBytes = new byte[8];
RNGCryptoServiceProvider saltGenerator = new RNGCryptoServiceProvider();
saltGenerator.GetBytes(saltInBytes);
string saltAsString = Convert.ToBase64String(saltInBytes);

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.Ticks

HTH

Ollie Riches

"David Pope" <dp***@nospam.satx.rr.com> wrote in message
news:O8**************@TK2MSFTNGP09.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**********@hotmail.com> schrieb im Newsbeitrag
news:OL*************@TK2MSFTNGP15.phx.gbl...
if it is not that frequent how aboout using the current date & time

e.g.

DateTime.Now.Ticks

HTH

Ollie Riches

"David Pope" <dp***@nospam.satx.rr.com> wrote in message
news:O8**************@TK2MSFTNGP09.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
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...
4
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...
2
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
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
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...
2
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...
14
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...
9
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...
16
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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.