By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,742 Members | 1,044 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,742 IT Pros & Developers. It's quick & easy.

default value of the foreign key field in a child table

P: n/a
There are two tables, parent and child table.

Foreign key field of the child table is not a required field. If the
data is submitted w/o a value into the foreign key field, what should
I make it as a default value? Should it be "null"?
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
re*********@hotmail.com (reneeccwest) wrote in message news:<9f**************************@posting.google. com>...
There are two tables, parent and child table.

Foreign key field of the child table is not a required field. If the
data is submitted w/o a value into the foreign key field, what should
I make it as a default value? Should it be "null"?


If the column is NULLable, then NULL should be acceptable; if you need
to enforce a default value, that suggests you should probably have a
NOT NULL column with a DEFAULT constraint. So it depends on your data
model and business rules.

Simon
Jul 20 '05 #2

P: n/a
Hi,

it MUST be NULL, otherwise you get a constraint violation; you can
define a default value but it have to be inserted on the master table.

Bye.

re*********@hotmail.com (reneeccwest) wrote in message news:<9f**************************@posting.google. com>...
There are two tables, parent and child table.

Foreign key field of the child table is not a required field. If the
data is submitted w/o a value into the foreign key field, what should
I make it as a default value? Should it be "null"?

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.