Quantcast
Channel: Recent Edits
Viewing all articles
Browse latest Browse all 12198

re: different result

$
0
0
Using DATALENGTH sees each character in an NVARCHAR string as two bytes.DECLARE @str NVARCHAR(50) = 'abcd'SELECT DATALENGTH(@str) -- 8 is returnedThis is because NVARCHAR's store the characters as double-byte unicode characters (UCS-2). Use VARCHAR if you want to store regular string data.For the trimming behaviour of LEN, see the comments at the LEN article: http://msdn.microsoft.com/en-us/library/ms190329.aspx

Viewing all articles
Browse latest Browse all 12198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>