Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7732245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:41:02+00:00 2026-06-01T06:41:02+00:00

When I try to create the a table the very first time, I always

  • 0

When I try to create the a table the very first time, I always get this error message:

sqlite returned: error code = 1, msg = AUTOINCREMENT is only allowed
on an INTEGER PRIMARY KEY

My code looks like this:

// debuggin identifier
private static final String TAG = DatabaseOpenHandler.class.getSimpleName();

// name and verison of the database
private static final String DATABASE_NAME = "OpenConfApp";
private static final int DATABASE_VERSION = 1;

// name and attributes of the table notes
public static final String TABLE_NAME_NOTES = "notes";
public static final String _NOTE_ID = "_noteId";
public static final String NOTE_CONFERENCE = "conferenceId";
public static final String NOTE_DATE = "dateInMillis";
public static final String NOTE_TEXT = "noteText";

// create table notes
public static final String TABLE_NOTES_CREATE = "CREATE TABLE "
        + TABLE_NAME_NOTES + " (" + _NOTE_ID
        + "INTEGER PRIMARY KEY AUTOINCREMENT, " + NOTE_CONFERENCE
        + " INTEGER, " + NOTE_DATE + " INTEGER, " + NOTE_TEXT
        + " INTEGER);";

// drop table notes
public static final String TABLE_NOTES_DROP = "DROP TABLE IF EXIST "
        + TABLE_NAME_NOTES;

public DatabaseOpenHandler(Context context) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
    Log.d(TAG, "onCreate called");
    db.execSQL(TABLE_NOTES_CREATE);
}

Sorry, I’m new to Android programming.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:41:03+00:00Added an answer on June 1, 2026 at 6:41 am

    Your code is correct Just you missed a space before your first integer statement.Write this:

    public static final String TABLE_NOTES_CREATE = "CREATE TABLE "
        + TABLE_NAME_NOTES + " (" + _NOTE_ID
        + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NOTE_CONFERENCE
        + " INTEGER, " + NOTE_DATE + " INTEGER, " + NOTE_TEXT
        + " INTEGER);";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is what I try to execute: CREATE TABLE order ( o_id INTEGER not
When I try to create a unique index on a large table, I get
Everytime I try to create the following table in MySQL command line: CREATE TABLE
I try to create unit test cases to check my table values are correct
I try to create a very simple app using windows API. I've done some
I have a table like this with a computed column: CREATE TABLE PhoneNumbers (
MyISAM allows very convenient way to create serials. E.g. In the table primary key
I am very, very new to MYSQL.I tried to create a table named option.
First of all, I want to say sorry for this very big question, but
I want to try create something like Zend's Server Pagecache. What I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.