Generate Random Primary Key

From: R. Paardekam (robin.paardekam_at_tutch.nl)
Date: 06/04/04


Date: Fri, 04 Jun 2004 14:21:04 +0200

Hello to everybody,

I hope one of you guys / girls can help me out because I am pretty sad
right now: couldn't find an answer on the net...

We got an MS SQL Server 2000 on a Windows 2003 Server and one of the
tables in my master-database is "out of integers". Well... we imported a
bunch of records from MS Access some months ago. In MS Access the
records where randomly generated. Now the SQL Server reached it's
maximum integer value (2147483647) resulting in an error when I try to
add a new one:

Microsoft OLE DB Provider for SQL Server error '80004005'
Arithmetic overflow error converting IDENTITY to data type int.
/import_robin_20040604.asp, line 175

Now I tried some things in SQL Server, but I must admit: I'm not really
a specialst in those things.

So my question is: can anyone tell me how to generate random integers?
(unique ofcourse!)

I hope to hear from anyone soon.

Thanks in advance,

Robin Paardekam
Tutch Mobile Media
(Robin.Paardekam[AT]Tutch.nl)