I want to add Unique query in combination of Two column.I am using this but this is not able make Unique. Please help Any help would be apperciated.
updateSQL = [NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS NewsData (id INTEGER PRIMARY KEY AUTOINCREMENT,NewsId TEXT ,NewsValue TEXT,Title TEXT,Region INTEGER)"];
update_stmt = [updateSQL UTF8String];
sqlite3_prepare_v2(database, update_stmt, -1, &addStatement, NULL);
sqlite3_step(addStatement);
sqlite3_reset(addStatement);
updateSQL = [NSString stringWithFormat:@"ALTER TABLE NewsData ADD UNIQUE (NewsId, Region)"];
update_stmt = [updateSQL UTF8String];
sqlite3_prepare_v2(database, update_stmt, -1, &addStatement, NULL);
sqlite3_step(addStatement);
sqlite3_reset(addStatement);
Aucun commentaire:
Enregistrer un commentaire