Re: [SQL] Unique constraint over null values

2002-09-30 Thread Josh Berkus
Thrasher, > I think I'll follow your advice, as this is the method that I had in my > pocket to use if I had no response. I tried with TRIM and other > functions in the CHECK constraint, but I guess that I cannot use > functions over a check field. > > It surprised me, but anyway, I'll do th

Re: [SQL] Unique constraint over null values

2002-09-30 Thread Thrasher
Hi Josh, I think I'll follow your advice, as this is the method that I had in my pocket to use if I had no response. I tried with TRIM and other functions in the CHECK constraint, but I guess that I cannot use functions over a check field. It surprised me, but anyway, I'll do that. Thanks a

Re: [SQL] Unique constraint over null values

2002-09-30 Thread Josh Berkus
Thrasher, > where type can be 's' for 'single' and 'x' for extended, so s should > mean that there is only the type and data1 field, and x means that all > fields are set. > > How can I set a unique constraint like CHECK (type = 's' AND UNIQUE > (type, data1)) OR (type = 'x' AND UNIQUE (type

[SQL] Unique constraint over null values

2002-09-30 Thread Thrasher
Hi all, I have a table like CREATE TABLE a ( typeCHAR (1) NOT NULL, data1 CHAR (16) NOT NULL, data2 CHAR (16) NULL ); where type can be 's' for 'single' and 'x' for extended, so s should mean that there is only the type and data1 field, and x means that all fie