Use INTEGER instead of INT and TEXT instead of VARCHAR...I think this
will resolve your error...

On Wed, Feb 23, 2011 at 9:35 PM, 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

-- 
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

Reply via email to