How can i get auto number in SQL database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sohail28
    New Member
    • Sep 2006
    • 10

    How can i get auto number in SQL database

    hello everyone,

    dear, i want to get my all database records with auto number (ID),

    For example:
    In Microsoft Access, to get Automatic Number Insertion, we create fields such as;

    [ FieldName---DataType
    ID ------- ------- AutoNumber


    Through this we get all our records in Access database in automat.

    Likewise, i want to apply same thing to SQL database Table, will it work?
    or is there any other DataType to be write instead of AutoNumber.

    let me know plzzzzzzzz
  • sang
    New Member
    • Sep 2006
    • 83

    #2
    in sql we use the datatype is auto_increment to get auto number.

    create table sample(id int primary key auto_increment, name varchar(20));

    I think this is you need.

    Comment

    Working...