Lets say I have two Tables, Widgets and PromoCodes. A widget can have zero or one promo code.What's the best way to impliment such a rule?Have a "blank / null record" in PromoCode and do this: ALTER TABLE [dbo].[Widget] ADD CONSTRAINT [FK_Conference_PromoCode] FOREIGN KEY ( [PromoCode] ) REFERENCES [dbo].[PromoCode] ( [PromoCode] )
Or should I "Allow Nulls" on the field in the Widget table and impliment it like this: ALTER TABLE [dbo].[widget] ADD CONSTRAINT [FK_Widget_PromoCode] FOREIGN KEY ( [PromoCode] ) REFERENCES [dbo].[PromoCode] ( [PromoCode] ) NOT FOR REPLICATION AlTER TABLE [dbo].[Widget] NOCHECK CONSTRAINT [FK_Widget_PromoCode]
I'm thinking the second way is best. Is that the way to impliment this? Or do I impliement a many-to-many type join?Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda>