Apologies Bill, I hit send before linking the actual documentation, here goes:

https://www.sqlite.org/partialindex.html

See especially section 2.1


Good luck!
Ryan


On 2016/06/13 9:16 PM, R Smith wrote:


On 2016/06/13 9:11 PM, Drago, William @ CSG - NARDA-MITEQ wrote:
All,

I am having trouble figuring out how to implement a conditional UNIQUE constraint.

Assume the following table:

CREATE TABLE myTable (
A INTEGER PRIMARY KEY,
B TEXT NOT NULL COLLATE NOCASE,
C TEXT NOT NULL COLLATE NOCASE,
D TEXT NOT NULL COLLATE NOCASE,
E INTEGER,
F TEXT COLLATE NOCASE,
G TEXT COLLATE NOCASE,
H TEXT COLLATE NOCASE
);

I need UNIQUE(B, C) only when E=0. I've searched all the usual places, but I can't find anything close enough to what I'm doing to be useful.

CREATE UNIQUE INDEX Idx_myTable_BC ON myTable (B,C) WHERE E=0;



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to