CREATE UNIQUE INDEX bcuif0e ON (b,c) WHERE e = 0;

Assuming you're not using a pre-WHERE clause on Indexes version of SQLite.  
Since unique constraints and unique indexes are functionally identical.


Peter 

    On Monday, June 13, 2016 12:11 PM, "Drago, William @ CSG - NARDA-MITEQ" 
<william.dr...@l-3com.com> 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.

Thanks,
--
Bill Drago
Staff Engineer
L3 Narda-MITEQ
435 Moreland Road
Hauppauge, NY 11788
631-272-5947 / william.dr...@l-3com.com

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


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

Reply via email to