Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 15264

len function and nvarchar

$
0
0

Hi we run 2012 enterprise and to be proactive i thought i'd ask the community what the len function will return on our nvarchar(30) col when our foreign partners start populating with chars that really need to occupy 2 bytes per visible char. 

I already see that len does an rtrim.   That's interesting but let's say they send a col value that occupies all 30 display positions with characters that require 2 bytes each?

Why do i ask?  First of all I see that our unicode data that contains chars that otherwise only require 1 byte count a fully populate column as len 30.  But I see max length in sql's meta data = 60.  And I will be applying the len function to this column in some of our etl and need to anticipate correctly the behavior that i will see under any condition including a mix of chars that would otherwise occupy 1 byte together with chars that require two bytes in storage.

Depending on the answer i may need to know from the community what function I would use to count visible chars instead of used bytes?  Its the visible chars I really want to count.


Viewing all articles
Browse latest Browse all 15264

Trending Articles



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