I have a varchar(800) column that is a primary key in one table and a FK to another.
The problem is that if I do len(field) – it says 186. If I copy/paste the text and I check it in notepad or something, I have 198 characters
The content is this :
http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNGGTo8JmCWDydNA19MrL4aON-02pA&url=http://creativity-online.com/news/chrysler-nokia-target-among-winners-of-teds-first-ad-contest/149189
Any ideas on why the length difference?
EDIT
You are right. I was using a web based sql manager and that tricked me.
Thank you.
Are you HTML encoding the URL after you have read it from the database?
moriartyn suggested that the SQL Server
lenfunction would count&as a single character, but that is not the case. However, if the actual content in the field is not HTML encoded, and it’s HTML encoded when inserted in the page, that would change each&character into&, which would account for the extra length.