tommyh (10/4/2010)
Well if one wants to be picky it does return the nr of bytes needed to represent the data. Hence why
select datalength(N'hi'), datalength('hi')
gives 2 different results. 4 vs 2. Because Unicode requires double the space.
That is what I intended to say, but apparently didn't bring across.
DATALENGTH returns the length (in bytes) of the storage for the actual data. For Unicode, that is 2 bytes per character. The seperate storage of the length is not included, since this is not part of the actual data.