Unique Long ID's in SQL Server 2005
-
I used to work in SQL Server 2000 and it's been a while. Now getting into a project with SQL Server 2005. I used to be able to create an auto-filling sequential record ID (effectively a long unique ID) assigned to every record so I could use that as a relational field among related tables. This seems to have been replaced by the uniqueidentifier type in SQL 2005? The problem is that a GUID is effectively a formatted string and a lot of characters, where the long is preferrable for me. How can I get a long int id that is sequential, and therefore unique for each record? Thanks!
-
I used to work in SQL Server 2000 and it's been a while. Now getting into a project with SQL Server 2005. I used to be able to create an auto-filling sequential record ID (effectively a long unique ID) assigned to every record so I could use that as a relational field among related tables. This seems to have been replaced by the uniqueidentifier type in SQL 2005? The problem is that a GUID is effectively a formatted string and a lot of characters, where the long is preferrable for me. How can I get a long int id that is sequential, and therefore unique for each record? Thanks!
CREATE TABLE example
(
[ID] bigint IDENTITY (1, 1)
)Works in both SQL Server 2000 and 2005.
Stability. What an interesting concept. -- Chris Maunder
-
CREATE TABLE example
(
[ID] bigint IDENTITY (1, 1)
)Works in both SQL Server 2000 and 2005.
Stability. What an interesting concept. -- Chris Maunder