What is the purpose of having the value type of DBNull?

Oct 19, 2011 at 2:59 AM

What is the purpose of having the value type of DBNull?

It is not even appearing in the Types folder, and any attempt to use it in an expression results in

TITLE: Expression Tester Tool for SQL Server 2008
------------------------------

Expression cannot be evaluated

------------------------------
ADDITIONAL INFORMATION:

The data type of variable "User::Test" is not supported in an expression.

Reading the variable "User::Test" failed with error code 0xC00470D0.

PS: User::Test is of type DBNULL

Coordinator
Oct 19, 2011 at 10:36 AM

There are perhaps two answers -

1 - Compatibility with Microsoft tools, they offer the type, and allow you to use it in the same way, as well as exhibiting the same behaviour. The error is from the MS expression evaluator itself, same as you'd see in their editor or at runtime.

2 - It doesn't make any sense to me for expressions, as it cannot be used, but see point 1 as to why it is there in this tool.