Friday, December 13, 2013

How to set the primary key in sqlite

I created a table to rowID primary key,
NSString * createSQL = [NSString stringWithFormat: @ "CREATE TABLE IF NOT EXISTS UsrTable (ROWID INTEGER PRIMARY KEY, DETAIL TEXT, IMAGE TEXT)"];
I want to know when I insert data in this primary key is not no need for me to set it manually. I can directly insert other data, the value of the primary key can automatically generate it. Or it should be how to assign it?
I found on the Internet, said in SQLite, the primary key is an integer type, if the value of the column can grow automatically.
Value I had to do was manually set the primary key, but do delete it will be a lot of problems.
Reply:
Just saying a few Zuiba, I want to knot posted.
Reply:
If you are self-energizing type of the primary key, insert it when you do not have to fill in the data;
You have to add autoincrease properties.
sqlite This property does not seem at this word, check on the line.

AUTOINCREMENT

No comments:

Post a Comment