Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Unique Long ID's in SQL Server 2005

Unique Long ID's in SQL Server 2005

Scheduled Pinned Locked Moved Database
questiondatabasesql-serversysadminhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike L
    wrote on last edited by
    #1

    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!

    M 1 Reply Last reply
    0
    • M Mike L

      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!

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      CREATE TABLE example
      (
      [ID] bigint IDENTITY (1, 1)
      )

      Works in both SQL Server 2000 and 2005.

      Stability. What an interesting concept. -- Chris Maunder

      M 1 Reply Last reply
      0
      • M Mike Dimmick

        CREATE TABLE example
        (
        [ID] bigint IDENTITY (1, 1)
        )

        Works in both SQL Server 2000 and 2005.

        Stability. What an interesting concept. -- Chris Maunder

        M Offline
        M Offline
        Mike L
        wrote on last edited by
        #3

        Thanks. I guess working in SQL Server Studio Express isn't the full product and isn't giving me all the options. I'll get the SQL Server access in the next few days and try it on there directly.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups