Create a 8 digit auto number

Posted on 2008-11-10
Last Modified: 2012-05-05
I have been told we need an 8 digit auto number given to each new record in our table
starting at 00000001.

Can this be done ?


Question by:dark22
    LVL 13

    Expert Comment

    not sure about starting from 00000001
    but one option could be to set 8 digit
    DBCC CHECKIDENT('YourTable', RESEED, 10000000)
    LVL 92

    Expert Comment

    by:Patrick Matthews
    Hello dark22,

    Why do you need to store the leading zeroes in the database?  Why not let it be a simple int identity column,
    and then format the result to be 8 digits in your queries/reports?



    Author Comment

    that maybe the way to go, I don't need to store it in the database,
    What happens is a query is run in Access 2000 to import certain records from the first DB into an access table.

    Can you make the access table format it to 8 digits ?
    LVL 92

    Expert Comment

    by:Patrick Matthews
    dark22 said:
    >>Can you make the access table format it to 8 digits ?

    The same issue applies: you could build the import process to do this, but why bother?

    Accepted Solution

    Ok then from that point it is exported to CSV file and then imported into an accounts program.

    It is the accounts program that requires an 8 digit account number for the record being imported.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    The steps for moving the system databases to a new location are documented in the following technical article: However sometimes after the moving process is finished, though SQL i…
    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now