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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. AutoNumber in SQL server

AutoNumber in SQL server

Scheduled Pinned Locked Moved Database
databasesql-serversysadmin
4 Posts 3 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.
  • U Offline
    U Offline
    User 3738736
    wrote on last edited by
    #1

    Does SQL Server have an autonumber datatype which will increment when adding record Karabo Mekgwe

    K R 3 Replies Last reply
    0
    • U User 3738736

      Does SQL Server have an autonumber datatype which will increment when adding record Karabo Mekgwe

      K Offline
      K Offline
      Krish KP
      wrote on last edited by
      #2

      YES. CREATE TABLE tblA( AutoID decimal(18, 0) NOT NULL IDENTITY (1, 1), Col2 varchar(10) )

      1 Reply Last reply
      0
      • U User 3738736

        Does SQL Server have an autonumber datatype which will increment when adding record Karabo Mekgwe

        R Offline
        R Offline
        RavikumarR
        wrote on last edited by
        #3

        yes that s IDENTITY See the example : CREATE TABLE Emp (EMPID int IDENTITY (1, 1) NOT NULL ,EMPNAME VARCHAR(20)) Above this examble Identity is like an auto increment. The Parameters (1,1) represents Start Number, Increment Number this example starts 1 and next incremented by 1 RK RK

        RK

        1 Reply Last reply
        0
        • U User 3738736

          Does SQL Server have an autonumber datatype which will increment when adding record Karabo Mekgwe

          R Offline
          R Offline
          RavikumarR
          wrote on last edited by
          #4

          yes that s IDENTITY See the example : CREATE TABLE Emp (EMPID int IDENTITY (1, 1) NOT NULL ,EMPNAME VARCHAR(20)) Above this examble Identity is like an auto increment. The Parameters (1,1) represents Start Number, Increment Number this example starts 1 and next incremented by 1

          RK

          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