424,476 Members | 1,529 Online
Need help? Post your question and get tips & solutions from a community of 424,476 IT Pros & Developers. It's quick & easy.

# How to Gnerate a Random ID Number

 P: n/a I just wana make a random id number based on4 digits-for examples?? Thanks in Advance Ch.Yallin Jun 9 '07 #1
11 Replies

 P: n/a "ch**********@yahoo.com"

 P: n/a ch**********@yahoo.com (ch**********@yahoo.com) writes: I just wana make a random id number based on4 digits-for examples?? checksum(newid()) is better than the rand() function. -- Erland Sommarskog, SQL Server MVP, es****@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx Jun 9 '07 #3

 P: n/a Erland Sommarskog I just wana make a random id number based on4 digits-forexamples?? checksum(newid()) is better than the rand() function. Please provide instructions on the use of these functions in MS- Access using the Jet engine. -- Bob Quintal PA is y I've altered my email address. -- Posted via a free Usenet account from http://www.teranews.com Jun 9 '07 #4

 P: n/a On 09 Jun 2007 20:04:22 GMT, Bob Quintal wrote: I think he was assuming a SQL Server back-end. -Tom. >Erland Sommarskog ch**********@yahoo.com (ch**********@yahoo.com) writes: >>I just wana make a random id number based on4 digits-forexamples?? checksum(newid()) is better than the rand() function. Please provide instructions on the use of these functions in MS-Access using the Jet engine.--Bob QuintalPA is y I've altered my email address. Jun 9 '07 #5

 P: n/a Tom van Stiphout wrote: I think he was assuming a SQL Server back-end. -Tom. I figured as much. But it would be nice to have a decent newid() function in Access. >>Erland Sommarskog >ch**********@yahoo.com (ch**********@yahoo.com) writes:I just wana make a random id number based on4 digits-forexamples??checksum(newid()) is better than the rand() function. Please provide instructions on the use of these functions in MS- >>Access using the Jet engine.--Bob QuintalPA is y I've altered my email address. -- Bob Quintal PA is y I've altered my email address. -- Posted via a free Usenet account from http://www.teranews.com Jun 9 '07 #6

 P: n/a Bob Quintal (rq******@sPAmpatico.ca) writes: Erland Sommarskog ch**********@yahoo.com (ch**********@yahoo.com) writes: >>I just wana make a random id number based on4 digits-forexamples?? checksum(newid()) is better than the rand() function. Please provide instructions on the use of these functions in MS- Access using the Jet engine. Sorry, I did not notice that the thread was cross-posted between the SQL Server and Access newsgroups. I assumed that since you posted in a newsgroup for SQL Server, you wanted a solution for SQL Server. I have no idea what might work in Access. -- Erland Sommarskog, SQL Server MVP, es****@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx Jun 10 '07 #7

 P: n/a Erland Sommarskog Erland Sommarskog >ch**********@yahoo.com (ch**********@yahoo.com) writes:I just wana make a random id number based on4 digits-forexamples??checksum(newid()) is better than the rand() function. Please provide instructions on the use of these functions inMS- Access using the Jet engine. Sorry, I did not notice that the thread was cross-posted between the SQL Server and Access newsgroups. I assumed that since you posted in a newsgroup for SQL Server, you wanted a solution for SQL Server. I have no idea what might work in Access. I didn't notice the cross-post either, and I don't know wether your solutin would be acceptable to the original poster. I sure would like the functionality of newid() in Access. -- Bob Quintal PA is y I've altered my email address. -- Posted via a free Usenet account from http://www.teranews.com Jun 10 '07 #8

 P: n/a >I just want to make a random id number based on 4 digits << Since it for an identifier this implies that there are no duplicates ("sampling without replacement" if you want to look it up). And there are only values 0000 thru 9999 available to you. Just generate a table of 10,000 rows and pull one out as you need it. m Jun 10 '07 #9

 P: n/a Thanks all Last post was suitable , according to my little experience in SQL Thanks All Ch.Yallin --CELKO-- : I just want to make a random id number based on 4 digits << Since it for an identifier this implies that there are no duplicates ("sampling without replacement" if you want to look it up). And there are only values 0000 thru 9999 available to you. Just generate a table of 10,000 rows and pull one out as you need it. m Jun 11 '07 #10

 P: n/a I know this is an odd question but I thought the new access was actual just a frount end to the destop version of SQLSERVER? Jun 15 '07 #11

 P: n/a On Fri, 15 Jun 2007 15:41:38 -0500, Seribus Dragon wrote: >I know this is an odd question but I thought the new access was actualjust a frount end to the destop version of SQLSERVER? Hi Seribus, No, it's not. You can *use* Access as a front-end to many different DB's, including the Desktop Engine, but it also comes with it's own builtin "database engine". (I enclose that in quotes because it lacks some of the features of truly high-end relational database engines). -- Hugo Kornelis, SQL Server MVP My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis Jun 15 '07 #12

### This discussion thread is closed

Replies have been disabled for this discussion.