我在 Android Sqlite 中创建表时尝试过使用 INTEGER AUTOINCREMENT。但它显示错误。但它在给 INTEGER PRIMARY KEY AUTOINCREMENT 时工作正常。
我的要求是,带有 AUTOINCREMENT 的列不应该是主键。
db.execSQL("CREATE TABLE " + Table_KOT_ITEMS_TEMP + "(" + col_Item_Name
+ " varchar(40) NOT NULL," + col_Ref_No
+ " int(11) NOT NULL DEFAULT '0'," + col_Table_No
+ " varchar(6) NOT NULL DEFAULT '0'," + col_Kot_No
+ " int(11) NOT NULL DEFAULT '0'," + col_Main_Item_Code
+ " varchar(10) NOT NULL," + col_Item_Type
+ " varchar(10) NOT NULL," + col_Item_Amount
+ " decimal(10,2) DEFAULT '0.00'," + col_Item_Qty
+ " decimal(9,3) NOT NULL DEFAULT '0.000'," + col_No_Of_Persons
+ " varchar(6) NOT NULL," + col_Dum_Unique
+ " varchar(25) NOT NULL," + col_CheckBox
+ " char(5) NOT NULL," + col_Item_Auto_ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT)");