Aidan,

Yes, I think you can have a FOREIGN KEY constraint referencing
another column in the same table. NULL values are OK too.

Nick

-----Original Message-----
From: Aidan Whitehall [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 12:08 PM
To: CF-Talk
Subject: Self-referencing constraint in SQL Server 7


With this table

CategoryID (PK)
Category
ParentCategoryID (NULL)

is there any way within SQL Server 7 to create a constraint that checks on
INSERT to see that the ParentCategoryID supplied is either NULL or exists as
a value in the CateogoryID column?



Thanks

-- 
Aidan Whitehall <[EMAIL PROTECTED]>
Netshopperuk
Telephone +44 (01744) 648650
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to