Sometimes it helps to read the documentation. On Feb 23, 10:14 am, Abhilash baddam <[email protected]> wrote: > Thanks Mark, > > You are right, datatype should come first. Thanks it's working > fine.. > > On Wed, Feb 23, 2011 at 9:16 PM, Mark Murphy <[email protected]>wrote: > > > Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine > > LogCat and look at the stack trace associated with your exception. > > > Your UNIQUE clause is incorrect. At minimum, the datatype needs to come > > first. > > > On Wed, Feb 23, 2011 at 10:35 AM, Abhilash baddam > > <[email protected]> wrote: > > > I used like that, but i am getting exception.../? > > > myDB.execSQL("CREATE TABLE IF NOT EXISTS bikes_list(_id INTEGER PRIMARY > > KEY > > > AUTOINCREMENT, name UNIQUE VARCHAR , availablebikes INT, slots INT,status > > > VARCHAR);"); > > > > On Wed, Feb 23, 2011 at 8:12 PM, Mark Murphy <[email protected]> > > > wrote: > > > >> Make the _ID AUTOINCREMENT and use a UNIQUE constraint on the name. > > > >> On Wed, Feb 23, 2011 at 9:32 AM, Abhilash baddam > > >> <[email protected]> wrote: > > >> > Hi Mark, > > >> > What's the solution for my problem, i want the _id column > > >> > should > > >> > have integer values and there should be increment. For the column name > > i > > >> > don't want to add duplicate values. Any alternate is there. > > > >> > On Wed, Feb 23, 2011 at 7:50 PM, Mark Murphy <[email protected] > > > >> > wrote: > > > >> >> AUTOINCREMENT is only available on INTEGER PRIMARY KEY columns: > > > >> >>http://sqlite.org/lang_createtable.html > > >> >>http://sqlite.org/autoinc.html > > > >> >> On Wed, Feb 23, 2011 at 9:15 AM, Abhilash baddam > > >> >> <[email protected]> wrote: > > >> >> > Hi, > > >> >> > I am trying to create a table, like this > > > >> >> > myDB.execSQL("CREATE TABLE IF NOT EXISTS bikes_list(_id INTEGER > > >> >> > AUTOINCREMENT, name PRIMARY KEY VARCHAR , availablebikes INT, slots > > >> >> > INT,status VARCHAR);"); > > >> >> > but i am getting this Exception, > > >> >> > ERROR/AndroidRuntime(11141): > > >> >> > Caused by: android.database.sqlite.SQLiteException: near > > >> >> > "AUTOINCREMENT": > > >> >> > syntax error: CREATE TABLE IF NOT EXISTS bikes_list(_id INTEGER > > >> >> > AUTOINCREMENT, name PRIMARY KEY VARCHAR , availablebikes INT, slots > > >> >> > INT,status VARCHAR); > > > >> >> > what may be the reason..? > > > >> >> > -- > > >> >> > You received this message because you are subscribed to the Google > > >> >> > Groups "Android Developers" group. > > >> >> > To post to this group, send email to > > >> >> > [email protected] > > >> >> > To unsubscribe from this group, send email to > > >> >> > [email protected] > > >> >> > For more options, visit this group at > > >> >> >http://groups.google.com/group/android-developers?hl=en > > > >> >> -- > > >> >> Mark Murphy (a Commons Guy) > > >> >>http://commonsware.com|http://github.com/commonsguy > > >> >>http://commonsware.com/blog|http://twitter.com/commonsguy > > > >> >> Android App Developer Books:http://commonsware.com/books > > > >> >> -- > > >> >> You received this message because you are subscribed to the Google > > >> >> Groups "Android Developers" group. > > >> >> To post to this group, send email to > > >> >> [email protected] > > >> >> To unsubscribe from this group, send email to > > >> >> [email protected] > > >> >> For more options, visit this group at > > >> >>http://groups.google.com/group/android-developers?hl=en > > > >> > -- > > >> > You received this message because you are subscribed to the Google > > >> > Groups "Android Developers" group. > > >> > To post to this group, send email to > > [email protected] > > >> > To unsubscribe from this group, send email to > > >> > [email protected] > > >> > For more options, visit this group at > > >> >http://groups.google.com/group/android-developers?hl=en > > > >> -- > > >> Mark Murphy (a Commons Guy) > > >>http://commonsware.com|http://github.com/commonsguy > > >>http://commonsware.com/blog|http://twitter.com/commonsguy > > > >> Android App Developer Books:http://commonsware.com/books > > > >> -- > > >> You received this message because you are subscribed to the Google > > >> Groups "Android Developers" group. > > >> To post to this group, send email to > > [email protected] > > >> To unsubscribe from this group, send email to > > >> [email protected] > > >> For more options, visit this group at > > >>http://groups.google.com/group/android-developers?hl=en > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to [email protected] > > > To unsubscribe from this group, send email to > > > [email protected] > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > -- > > Mark Murphy (a Commons Guy) > >http://commonsware.com|http://github.com/commonsguy > >http://commonsware.com/blog|http://twitter.com/commonsguy > > > Android App Developer Books:http://commonsware.com/books > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

