Creating auto-increment field in SharePoint List

In SharePoint, we can create the auto-incremental field by many ways, I am going to discuss two ways of doing it.
Calculated field
Item Event Receiver
1. Using Calculated field:
Using this we can accomplish it without doing any programing and it is a relatively simple way of doing it. By using “Calculated” column in SharePoint List we can create auto-increment field. We can accomplish this by creating a new column and choosing the
column type as “Calculated (calculation based on other columns)”. And in Formula field, we have to enter [ID]
In fact this will be using the values from “ID” field from SharePoint list that starts from 1.
For example, if we want to start our auto-increment column from 100, we can modify the “Formula” field of Create New column screen, we can have to enter [ID] + 99
For detailed info please follow the blog I wrote here: http://faisalrafique.wordpress.com/2011/03/19/creating-auto-increment-field-in-sharepoint-list/
2. Using Item Event Receiver:
By using this strategy, users have advantage to edit the existing values, we can also avoid it by making field read-only on feature activation. Using item event receiver, on ItemAdded event, we have to find the highest value among previously added items
and then save the incremented value to current newly created auto-incremental column.
For code of event reciever please follow the blog I wrote here:
http://faisalrafique.wordpress.com/2011/03/19/creating-auto-increment-field-in-sharepoint-list/
Happy Coding

Use Sharepoint Designer to create a Workflow for the list containing the field to increment. For my project I had an Invoice field that I wanted to start with 1001 and increment from there so I made the following workflow to do this.
In the new workflow screen in Sharepoint Designer create two actions in Step 1:
Calculate Current Item:ID plus 1000 (Output to Variable: calc)
then Set AutoIncrementNumber to Variable: calc
This is just a guide. If you just want the auto-increment to start with 1 then you can just use this step
Set AutoIncrementNumber to Current Item:ID
Also, make sure you select the correct name for your field in the Workflow action instead of AutoIncrementNumber.
Save the Workflow, close it, and then open it again in Sharepoint Designer. Check the box for "Start workflow automatically when an item is created." Save it again and then click on the Publish button to make it active on the sharepoint site. The value should
now increment for each new item created in the list.

Similar Messages

  • Create Auto increment sequence number for list view report

    Hi All,
              Am using BAM 11.1.1.6 version, Have updating list report & wants to create auto increment sequence number at report level. Is it possible to create column at run time in BAM reports.
    Please help.
    Thanks.

    Hi All,
              Am using BAM 11.1.1.6 version, Have updating list report & wants to create auto increment sequence number at report level. Is it possible to create column at run time in BAM reports.
    Please help.
    Thanks.

  • How to generate auto increment id for sharepoint list item using calculated column?.

    Dear all,
    List Id will be auto generated in the format “TP_W1_SCO_00001”.(00001 Numbers will keep changing for the documents).
    FOR EX:-
    first listem ID :TP_W1_SCO_00001
    sECOND listem ID :TP_W1_SCO_00002
    Please tell me how to do it by using calculated column.
    Regards
    swapna
    SWAPNA

    In this solution you have to make two additional columns and one workflow.
    step 1 :
    create column ‘pID’ on the list of the type number.
    Step 2:
    Create on the list with SharePoint Designer a listworkflow
    Set in the start option: ‘Start workflow automatically when an item is create’
    In the workflow you set de column 'pID' with the value from 'ID' ( standard column)
    Use for this the option: ‘Set field in current item’.
    You need that because you can't use the column 'ID' in the formula in an calculated column
    Step 3:
    create column ‘IssueID’ on the list of the type calculated column.
    Use the formula:
    =""&"TP_W1_SCO_"&[pID]
    /blog
    twttr @esjord

  • I have date type list field in sharepoint list and i have created one form in sharepoint webpage.

    Hi All,
    i have date type list field in sharepoint list and i have created one form in sharepoint webpage.
    Now i want to save that field from shareepoint webpage, its declared "t1.text" but its showing error.
    How can i save this field?

    Hi AnilKarthink, 
    I wrote a Technet Wiki article on saving data to the various SharePoint fields. You can view it here: http://social.technet.microsoft.com/wiki/contents/articles/21801.sharepoint-a-complete-guide-to-getting-and-setting-fields-using-c.aspx
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • Creating a Report Using a SharePoint List

    I am using a SharePoint List that Named as 'Service Requests'. It has some fields with Date, Time, Status. The Date & Time will be entered. The Status as three values & those will be selected using a Drop Down List Box. The Statuses are 'In Progress,
    Completed, In completed'.
    I want to create a Report using this SharePoint List that include status with other fields in monthly basis. As an example I want the report about the Service Requests within the December month.
    I also need to know how am I able to link this report to a Web Menu that in the SharePoint Site. Because there is a web menu in that SharePoint Site. I have not developed this site so I don't know the type of the web menu of this site.
    I think someone can help me to solve these problems.
    Regards,
    Chiranthaka

    Hi Chiranthaka,
    According to your description, my understanding is that you want to create a report based on a SharePoint list.
    I agree with Trevor’s and Mohammad’s suggestion to use SQL Server Reporting Service to create the report for SharePoint list.
    You need to configure Reporting Services for SharePoint 2010 and then use it to create reports.
    Here are two links with the detailed steps to create report using SSRS with SharePoint for you to refer:
    http://aaclage.blogspot.in/2011/11/create-reports-with-sharepoint-2010-and.html
    http://nikpatel.net/2010/06/11/step-by-step-consuming-sharepoint-2010-lists-data-in-the-ssrs-2008-r2-reports/
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Integer auto-increment fields

    I am using 3.0.3 and have a PC class that uses application identity and
    MSSQL server, so we are using auto-increment fields for our primary keys.
    In the past (with sequence-generated ids) we have used Integers for our
    mapped attributes, but with the application identity, it seems we need to
    use ints. Is there a reason for this, or is it a bug?
    Nathan

    Great. Thanks for the help.
    Nathan
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    This is a bug. I've reported it at:
    http://bugzilla.solarmetric.com/show_bug.cgi?id=910
    I expect it will be fixed in the next release. In the meantime, if you
    want to use a numeric wrapper for your auto-increment field, it will
    need to be of type java.lang.Long.
    In article <[email protected]>, Nathan Voxland wrote:
    It does work with Longs. I could switch my code to use Longs, although
    I
    don't always need that large of an id field.
    Nathan
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    If you change them both from Integer to a Long field, then does it
    work?
    >>>
    >>>
    In article <[email protected]>, Nathan Voxland wrote:
    Here is the code for the class and the ApplicationId class. The
    ApplicationId class was generated using the appidtool.
    public class Portfolio {
    private Integer id;
    private String name;
    private String notes;
    private Organization client;
    private Portfolio parentPortfolio;
    private Set subPortfolios;
    private Set projects;
    private Date created;
    private Person createdBy;
    private Date lastModified;
    private Person lastModifiedBy;
    public Portfolio(PersistenceManager pm) {
    pm.makePersistent(this);
    this.subPortfolios = new HashSet();
    this.projects = new HashSet();
    this.created = new Date();
    this.createdBy = new PersonPeer(pm).findLoggedIn();
    this.lastModified = this.created;
    this.lastModifiedBy = this.createdBy;
    public Integer getId() {
    return new id;
    public String getName() {
    return name;
    public void setName(String name) {
    this.name = name;
    public void jdoPostLoad() {
    public void jdoPreStore() {
    if (!((PersistenceCapable) this).jdoIsNew()) {
    this.lastModified = new Date();
    this.lastModifiedBy = new
    PersonPeer(((PersistenceCapable)
    this).jdoGetPersistenceManager()).findLoggedIn();
    public void jdoPreClear() {
    public void jdoPreDelete() {
    * Auto-generated by:
    * kodo.enhance.ApplicationIdTool
    public class PortfolioId
    implements Serializable
    static
    // register persistent class in JVM
    Class c = Portfolio.class;
    public Integer id;
    public PortfolioId ()
    public PortfolioId (String fromString)
    if ("null".equals (fromString))
    id = null;
    else
    id = new Integer (fromString);
    public String toString ()
    return String.valueOf (id);
    public int hashCode ()
    return ((id == null) ? 0 : id.hashCode ());
    public boolean equals (Object obj)
    if (this == obj)
    return true;
    if (!(obj instanceof PortfolioId))
    return false;
    PortfolioId other = (PortfolioId) obj;
    return ((id == null && other.id == null)
    || (id != null && id.equals (other.id)));
    Nathan
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    Is the primary key field an Integer in both the application
    identity
    class and the persistent class itself? They need to both be the same
    class.
    If they are the same, and you are still getting the exception, could
    you post the code for the classes (or else mail them to
    [email protected])?
    In article <[email protected]>, Nathan Voxland
    wrote:
    When I have my object use an int id, my test runs fine, when Iswitch
    to
    an
    Integer, I get the exception:
    kodo.util.FatalException: java.lang.ClassCastException
    NestedThrowables:
    java.lang.ClassCastException
    at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:563)
    at
    com.correlat.intranet.projectmanagement.PortfolioTest.testFlush(PortfolioTes
    t.java:393)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(UnknownSource)
    at
    com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(Unknown
    Source)
    at
    com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(Unknown
    Source)
    at com.intellij.rt.execution.junit2.JUnitStarter.main(UnknownSource)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at com.intellij.rt.execution.application.AppMain.main(UnknownSource)
    Caused by: java.lang.ClassCastException
    at
    com.correlat.intranet.projectmanagement.Portfolio.jdoReplaceField(Portfolio.
    java)
    atkodo.runtime.StateManagerImpl.replaceField(StateManagerImpl.java:2771)
    at
    kodo.runtime.StateManagerImpl.storeObjectField(StateManagerImpl.java:2272)
    atkodo.runtime.StateManagerImpl.storeObject(StateManagerImpl.java:2252)
    at
    kodo.jdbc.meta.ValueFieldMapping.setAutoIncrementValue(ValueFieldMapping.jav
    a:346)
    atkodo.jdbc.meta.ClassMapping.setAutoIncrementValue(ClassMapping.java:381)
    at
    kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.ja
    va:137)
    atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:357)
    atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:153)
    at
    kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:72)
    atkodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:507)
    at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:158)
    at
    kodo.datacache.DataCacheStoreManager.flush(DataCacheStoreManager.java:412)
    at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.jav
    a:794)
    at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:550)
    ... 24 more
    NestedThrowablesStackTrace:
    java.lang.ClassCastException
    at
    com.correlat.intranet.projectmanagement.Portfolio.jdoReplaceField(Portfolio.
    java)
    atkodo.runtime.StateManagerImpl.replaceField(StateManagerImpl.java:2771)
    at
    kodo.runtime.StateManagerImpl.storeObjectField(StateManagerImpl.java:2272)
    atkodo.runtime.StateManagerImpl.storeObject(StateManagerImpl.java:2252)
    at
    kodo.jdbc.meta.ValueFieldMapping.setAutoIncrementValue(ValueFieldMapping.jav
    a:346)
    atkodo.jdbc.meta.ClassMapping.setAutoIncrementValue(ClassMapping.java:381)
    at
    kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.ja
    va:137)
    atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:357)
    atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:153)
    at
    kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:72)
    atkodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:507)
    at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:158)
    at
    kodo.datacache.DataCacheStoreManager.flush(DataCacheStoreManager.java:412)
    at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.jav
    a:794)
    at
    kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:550)
    at
    com.correlat.intranet.projectmanagement.PortfolioTest.testFlush(PortfolioTes
    t.java:393)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at com.intellij.rt.execution.junit2.JUnitStarter.main(UnknownSource)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at com.intellij.rt.execution.application.AppMain.main(UnknownSource)
    Nathan
    "Patrick Linskey" <[email protected]> wrote in message
    news:[email protected]...
    What behavior are you seeing that is preventing you from using
    Integers?
    -Patrick
    Nathan Voxland wrote:
    I am using 3.0.3 and have a PC class that uses application
    identity
    and
    MSSQL server, so we are using auto-increment fields for our
    primary
    keys.
    In the past (with sequence-generated ids) we have used Integers
    for
    our
    mapped attributes, but with the application identity, it seems
    we
    need
    to
    use ints. Is there a reason for this, or is it a bug?
    Nathan
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Auto increment field in database issue

    Ok, I have read all about the issues with the auto increment field when trying to hook my form up to a ms access database.
    My problem is that the auto increment field is the one field I want in my form.
    Any suggestions how to create a new record with my form? its a simple database, date field, and PO number (the auto incremented field)
    Just trying to get a fresh PO number on my PO form each time its filled out....

    I have a vital form that clients fill out, which is passed to many people in the company along the workflow. The form is a Planner and we have in the following PDF, Word Doc..
    Well before, the Planner.pdf was originally created in Word, since most people have access to Word.. but evolved to a PDF form created from the Word Doc via Adobe LiveCycle Designer 8.0 w/ User Rights enabled so that the form could be filled out and saved using Adobe Reader.. which was a step better than Word.. being that it is free. But this needed to be easier and more to the point b/c some clients don't particularly like installing the latest version of Reader, even if you provide them the link. Nor do they like saving the form, filling the form, and attaching the form to send back.
    My goal is to have the client fill an HTML version of the form, submit and be done with it, but everyone in the workflow be able to easily receive the filled Planner as a PDF form.
    So some months ago I ran into this post Chris Trip, "Populate Livecycle PDF from mySQL database using PHP" #8, 22 Sep 2007 4:37 pm
    which uses the command line Win32 pdftk.exe to merge an FDF file into an existing PDF on the remote server, and serve this to whoever.
    My problem was with shared hosting and having the ability to use the Win32 pdftk.exe along with PHP which is predominantly used on Linux boxes. And we used a Linux box.
    so i created the following unorthodox method, which a client fills the HTML version of the Planner, all field values are INSERTED into a table in MySQL DB, I and all filled planners that have been filled by clients to date can be viewed from a repository page where an XML file is served up of the corresponding client, but someone would have to have Acrobat Professional, to import the form data from the XML file into a blank form.. altoughh this is simple for me.. I have the PHP file already created so that when a Planner is filled and client submits. >> the an email is sent to me with a table row from the repository of the client name, #, email, and a link to d-load the XML file,
    But I also have the PHP files created so that the Planner can be sent to by email to various people in the workflow with certain fileds ommitted they they do not need to see, but instead of the XML file beiong served up i need the filled PDF Planner to be served.
    I can do this locally with ease on a testing server, but I am currently trying to use another host that uses cross-platform compatibility so i can use PHP and the pdftk.exe to achieve this, as that is why I am having to serve up an XML file b/c we use a Linux server for our website, and cant execute the exe.
    Now that I am testing the other server (cross-platform host), just to use them to do the PDF handling (and it's only $5 per month) I am having problems with getting READ, WRITE, EXECUTE permissions..
    Si guess a good question to ask is can PHP do the same procedure as the pdftk.exe, and i can eleminate it.
    or how in the heck can i get this data from the DB into a blank PDF form, like i have described??
    here are some link to reference
    Populating a LiveCycle PDF with PHP and MySQL
    http://www.andrewheiss.com/Tutorials?page=LiveCycle_PDFs_and_MySQL
    HTML form that passed data into a PDF
    http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFFormsUsingHTML/index.htm l
    and an example
    http://accesspdf.com/html_pdf_form/

  • Auto incremented field mobile device

    hello,
    my colleague requires to make a mechanism in the mobile device (oracle lite client) where the primary field of a table is automatically incremented.
    according to the documentation in order to make that happen in a consistent manner so that all clients can sync correctly without ambiguities , we created a sequence
    through the MDW and attached it to the publication. then with the sync , this sequence has been downloaded to all clients and each one has a specified window.
    now we suppose that we must create the trigger that uses this sequence in order to provide the correct primary key field.
    lets say that the sequence is names SYSTEM.AUTOINCSEQUENCEA
    the table is named SYSTEM.TABLEA
    and the primary key that we want to auto incr is named ID.
    the trigger we suppose that should look like:
    CREATE TRIGGER SYSTEM.TRIGGERTABLEA
    BEFORE INSERT
    ON SYSTEM.TABLEA REFERENCING NEW AS New OLD AS Old
    FOR EACH ROW
    BEGIN
    select AUTOINCSEQUENCEA.nextval into :new.ID from dual;
    END ;
    1)But if i execute this from the msql on the client device (mobile windows device) it returns a "syntax error". how can i create the trigger that i need which will use my sequence in order
    to appoint the new values on the primary key (auto incremented field??) .
    2)if i cant do it through a normal sql statement then how can i do it?
    thank you

    You need Java Store Procedure as the trigger. PL/SQL is not support on the Oracle Lite client.
    Let me know if you need an example on how to do this.

  • Does all RDBMS support auto-increment field?

    Hi,
    I am designing a java application in which I have to write some logic to auto-increment one database field. Can anyone tell me that all the databases support the auto-increment fields.
    Thanks in advance.
    Chris

    There seem to be two kinds of facility for this in databases. One kind has an auto-increment field. Unfortunately they aren't consistent about how you obtain the value just created after an insert (which you almost invariably require to know). Generally you use a select statement to pick up the value of some kind of last row index function, but the name and syntax varies.
    The other kind uses a separate object in the database called a SEQUENCE. You create this with a CREATE SEQUENCE statment, and generally you reference nextval(sequence_name) in the default attribute of the database field.
    To get the last allocated sequence number you use select currval(sequence_name)
    Again the syntax is a bit inconsistent. You should also probably use transaction isolation if someone else might be incrementing the same sequence.

  • How to create a special view for sharepoint list A and deploy this view to specific user personal view?

    How to create a public view for sharepoint list A and deploy this view to specific user personal view? Is that possible OOTB?

    Views cannot be exported or moved. Can you elaborate your requirement?
    --Cheers

  • Auto Increment Field / Sequence - How?

    Am I missing something here - is there no build in support to tie a datatables auto incriment field to a sequence so that it will be automatically retrieved on a update command?
    I have a table that has a field (RECORD_ID) that gets it's value from a Sequence (RECORD_IDSEQ).
    I am retrieving a dataset and setting the RECORD_ID field to autoincrement, setting the seed & step to -1. Then I am adding some records & I see the autoincrement field i working correctly. UNFORTUNATELY, I still have to iterate through the table before I call an update in order to insert (from another function) the RECORD_IDSEQ.NEXTVAL value into the RECORD_ID column.
    Surely I am missing something. It sure seems simple enough to have a property of the autoincrement field/command builder that relates to the SEQUENCE name so that the update method generates the RECORD_IDSEQ.NEXTVAL automagically.
    Can anyone shed any light on this for me?
    Thanks!

    Bob,
    Currently, there's no built-in "link" between the .NET DataTable's auto-increment field and the Oracle sequence.
    Therefore, you will need to execute a custom update command or a custom insert command which uses the RECORD_IDSEQ.NEXTVAL for the RECORD_ID column (rather than the auto-generated SQL via the CommandBuilder).
    Furthermore, in your custom SQL you can have a RETURNING clause which returns the RECORD_ID column value to populate back into the DataTable so that the sequence values in the Database is in sync with those in the DataTable.
    We'll consider providing a way to "link" the DataTable auto-increment column to an Oracle sequence in a future release.

  • Create a Lookup for ProjetServer field in SharePoint List item

    Hi,
    I would like to display values in custom fields of MS Project Server 2010 in Ms SharePoint list 2010. The values ought to be displayed as lookup in a field of Listitem form. I would like to futher query and populate certain fields in New
    Items form from Project Server based on the value in the lookup.
    I am looking for guidance to implement this. Any help in this regard will be appreciated.

    Abhijit,
    You could do this by creating an External Column, connected to an External COntent Type from Project Server.
    Andrew Lavinsky has several good blog posts on using ECTs in Project Server. Here is an example: http://azlav.wordpress.com/2011/04/05/creating-a-centralized-document-repository-with-external-content-types/
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:
      

  • Creating auto increment custom metadata field in UCM

    Hello,
    Can anyone tell how to create a metadata Integer field with Auto Increment option?
    Also while creating users, I have a custom Department field. I want this field to be displayed in my profile. How can i achieve this?
    Richa

    SHort of paying someone else to do the work for you I am afraid there is no shortcut.
    However writing a component need not be difficult or complex if you take a sensible approach.
    There are some excellent blogs out there, at least one comprehensive book and even the documentation will get you started
    http://download.oracle.com/docs/cd/E10316_01/cs/cs_doc_10/documentation/developer/sdk_getting_started_10en.pdf
    I recommend you get Bex's book and you should be able to get a new component like this up and running in a day or two.
    Tim

  • Creating an auto incrementing field with CREATE TABLE from Java

    I'm using the "sun.jdbc.odbc.JdbcOdbcDriver" to get a connection towards an ODBC data source that's linked to a Access (.mdb) database.
    I've tried various combinations in my CREATE TABLE statement execution in order to create a table with an auto incrementing integer but neither of them work, not even the most obvious one:
    stmt.executeUpdate("CREATE TABLE mytable(uid integer AUTO_INCREMENT PRIMARY KEY);");
    I always get this runtime exception: *java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in field definition*; and AUTO_INCREMENT is the problem. I've tried all variations like AUTO, INCREMENT, AUTOINCREMENT and such, but nothing works.
    I've looked everywhere but couldn't find an answer to this. Thanks for the help.

    You used MySQL syntax. I think you agree with me that Access isn't a MySQL database. Either use MySQL with a real JDBC driver (recommended) or use Access syntax.
    That said, creating databases and tables using Java is a bad idea. The database and table must be already there. With Java you just do the usual table operations like select, insert, update and delete. Nothing more is needed.

  • Is there easy way to create auto increment number?

    Hello SharePoint Fam,
    Is there a easy solution to have a auto increment column that just creates new number on each new item.
    Wanting something like:
    14-0001
    14-0002
    14-0003
    14-0004
    14-0005
    Thanks n advance

    If you need a simple auto increment column then you can use "ID" field which is already present in Sharepoint. 
    It will increment in this fashion: 1,2,3,4...........
    or
    you can take field as "Calculated" and use formula (="14-" & [ID]) without parentheses.
    it will increment in this fashion 14-1, 14-2, 14-3............
    or
    try this link...may be you will find something helpful here...
    http://dlairman.wordpress.com/2011/01/10/add-a-unique-auto-incrementing-column-to-a-sharepoint-list/
    ***If my post is answer for your query please mark as answer***
    ***If my answer is helpful please vote ***

Maybe you are looking for

  • Radial filter doesn't sync right

    Is any one encountering a problem with radial filter when sync it to multiple images? I am getting a different dimention and position every time I sync or press previous. For the rest of the settings are remaing the same.

  • Flickering/Refresh rates RoboHTML 6.0

    We just recently upgraded to RoboHTML 6.0. Now the Topics Pane on the left-hand side of the screen refreshes constantly. This constant flickering is enough to drive you batty. I looked at refresh rates in the online help & the only thing I could find

  • Which table has quantity balance (outstanding) on STO.

    Hello Friends, I have to modify a report.  The report has a list of plant + material + batch, and I need to find out whether any STO is open for that material and/or material-batch.  What is the easiest way, and from which tables/fields, to get this

  • Attachments as files as opposed to the complete view of message in the mail

    When I attach i.e a PDF document from the desktop, it shows up in full in the mail. I would like to attach it as a file, like done in Windows. How to do this?

  • ECC Transactions in HANA

    HI Every One,    Our requirement is to run the ECC 6.0  Tcodes in HANA. Could any one please  share the views in order to acheive. Thanks in advance. Thanks & Regards, Siva Rama Prasad.G Message was edited by: SivaRamaPrasad glnv