In message <[EMAIL PROTECTED]>, Jay Sprenkle wrote: > > Hi All, > > > > I'm creating a database which will look a little like: > > create table main (f1 TEXT, f2 TEXT, f3 TEXT, t1 TEXT, t2 TEXT, tn TEXT); > > > > f1, f2 and f3 will always be present. Any or all of the ts might be NULL. > > > > I'd like to prevent entries where all of the fields are the same being > > created. How can I do this. I've tried experimenting with UNIQUE KEYs but > > haven't been successful - perhaps because of the NULLs? > > You might try adding NOT NULL to your column constraints and > a default to an empty string in the create table. > I thought UNIQUE implied NOT NULL but I might be > wrong.
Thanks a lot - I think I've got it working now: create table main (f1 TEXT not null default '~', f2 TEXT not null default '~', f3 TEXT not null default '~', t1 TEXT not null default '~', t2 TEXT not null default '~', tn TEXT not null default '~'); ...gives me an error when I try to insert two similar rows :-) Now I'll just have to work out how to sensibly deal with the error in my C app. Cheers, Adam -- Adam Richardson Carpe Diem