• Hugo Kornelis (8/27/2010)


    frodriguez.im (8/26/2010)


    what is an empty value? AFAIK, NULL is the only way to leave a field empty!

    For string columns and variables, the empty string is an often-used synonym for the zero-length string: ''.

    I guess a varbinary could also be considered empty when the contents are zero-length. Other data types do not support an empty value, as there are no empty values in the various numeric domains, nor in the date, time, or datetime domains. (Maybe xml does support some kind of empty value, though I think you can only do that with untyped xml - but I am far from an expert in the field of xml, so I might be wrong).

    I thought about that when I was writing my comment, my rationale for not mentioning it is that:

    a) NULL is type independent and these are not so they're sort of not in the same context (in my head at least :)); and

    b) although they are widely accepted, in essence these are magic values so it's not really empty.

    ps. you can use an empty string to set an "empty" xml field, you can also use an empty document header or any xml that doesn't really contains any data, either way when you query it and convert it to a string you get an empty string.