Wow! Thanks for the quick reply and link to documentation. When I searched on line for conditional unique constraint I found all sorts of complicated examples that sent me off in the wrong direction.
Thank you! -- Bill Drago Staff Engineer L3 Narda-MITEQ 435 Moreland Road Hauppauge, NY 11788 631-272-5947 / william.dr...@l-3com.com > -----Original Message----- > From: sqlite-users-boun...@mailinglists.sqlite.org [mailto:sqlite-users- > boun...@mailinglists.sqlite.org] On Behalf Of R Smith > Sent: Monday, June 13, 2016 3:22 PM > To: sqlite-users@mailinglists.sqlite.org > Subject: Re: [sqlite] Trouble coding conditional UNIQUE > > 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 CONFIDENTIALITY, EXPORT CONTROL AND DISCLAIMER NOTE:This e-mail and any attachments are solely for the use of the addressee and may contain information that is privileged or confidential. Any disclosure, use or distribution of the information contained herein is prohibited. In the event this e-mail contains technical data within the definition of the International Traffic in Arms Regulations or Export Administration Regulations, it is subject to the export control laws of the U.S.Government. The recipient should check this e-mail and any attachments for the presence of viruses as L-3 does not accept any liability associated with the transmission of this e-mail. If you have received this communication in error, please notify the sender by reply e-mail and immediately delete this message and any attachments. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users