General information
Forum:
Microsoft SQL Server
We are just trying to decide whether a record that lacks a foreign key should have the key listed as 0 or NULL. I think that 0 is easier to work with. For example, if we want to exclude records with a certain two foreign keys or no foreign key, we would say:
SELECT * FROM Table1 WHERE NOT INLIST(Foreign_Key, 13, 32, 0)
as opposed to
SELECT * FROM Table1 WHERE NOT INLIST(Foreign_Key, 13, 32) AND Foreign_Key IS NOT NULL
Jerry
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only