Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2006, 07:06 AM
Authorized User
 
Join Date: Jun 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL script to create a unique ID for records

We need to create a unique ID, more like a line number, and similar to the manner in which MS Access creates an ID when you import files.

We have scripts (cursors) that create occurence numbers, but these rely on there being a date somewhere.

Does anyone have a method for creating this unique ID / Line number?

Many thanks in advance

John

 
Old October 16th, 2006, 07:25 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You can have a column of type UniqueIdentifier and then use a default of NewId() or you can have an int column as a primary key with the IDENTITY property set.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
generate unique id capri SQL Server 2000 1 April 6th, 2008 10:18 AM
Create Unique Id langer123 Classic ASP Basics 0 April 6th, 2005 01:27 PM
create a unique id in asp code langer123 Classic ASP Basics 1 March 15th, 2005 03:55 AM
Getting Unique ID from Database Nicky_uk Classic ASP Databases 9 January 26th, 2005 04:45 PM
how to create an email id through php script manu_mcs Pro PHP 0 December 8th, 2003 03:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.