Can I index the existence of a value in a column (whether it is null or not)?
I have a varch开发者_开发百科ar(999) column that I want to select only when it is not NULL.
Is there an efficient way to check whether a row has NULL value or not without indexing all the possible values for this column?
Well, the WHERE col IS NOT NULL
may use the NULL bitmap but it's a clustered index scan.
Or you just index the column and take the hit. Or use an indexed view with the IS NOT NULL filter.
Unfortunately, this isn't resolved elegantly until "filtered indexes" SQL Server 2008
精彩评论