How to set autoinc

KisuKisu Member Posts: 381
edited 2008-10-14 in SQL General
How do I set the start value for autoinc field so it wont start from the last value I had before clearing the table?

Table, Test, 123456700
Variable line, datatype bigint, autoincrement
K.S.

Answers

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Navision resets this when you change back and forth from autoincrement and not.

    You can also do this with a SQL script. I do not have this available from the top of my head but I am sure that if you use google on Reset Identity Insert (SQL terminology) you will get the proper results.
  • KisuKisu Member Posts: 381
    Navision resets this when you change back and forth from autoincrement and not.

    You can also do this with a SQL script. I do not have this available from the top of my head but I am sure that if you use google on Reset Identity Insert (SQL terminology) you will get the proper results.

    Okay, thanks :)
    K.S.
  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from 'NAV/Navision' forum to 'SQL General' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • strykstryk Member Posts: 645
    If you want to reset the AutoIncrement values via TSQL this would be the TRUNCATE TABLE command (this deletes all data from the table and resets the identity value).


    If you want to set a specific value for an AutoIncrement field, and/or a specific increment value you could use the IDENTITY feature from SQL Server (check out the "Books Online" for details).

    Best regards,
    Jörg
    Jörg A. Stryk (MVP - Dynamics NAV)
    NAV/SQL Performance Optimization & Troubleshooting
    STRYK System Improvement
    The Blog - The Book - The Tool
Sign In or Register to comment.