utorak, 22. rujna 2009.

Allow foreign key null value in SQL Server

PROBLEM:
Allow in SQL SERVER a foreign key to have null values or values that can not be found in the related table (like 'zero')

SOLUTION:
It is not possible to insert null values in ViewTable mode. You need to use Right click on empty space in ViewTable mode, -> Pane -> SQL and use insert script.
(allow null values in Designe mode)

example
INSERT INTO SSS
(Literature_ID, Location_ID, Species_ID, Pronalazac_ID, Datum_ID)
VALUES (NULL, NULL, 11, NULL, NULL)