Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

My blog on SQL Server, TSQL, MSBI and other areas of SQL Server.
Browse by Tags · View All
Cube in Sql Server.. 2
RollUp 2
Groupby 2
Use of NULLIF 2
Procedures 2
Search Objects (Table Name 2
LEN 1
DATALENGTH 1
Happy diwali 1
SP_Rename 1

Archive · View All
May 2012 10
June 2012 7
October 2012 3
July 2012 2
June 2013 1
November 2012 1
September 2012 1

what are Difference between DATALENGTH and LEN?

Jun 18 2013 12:00AM by Nirav Gandhi   

1) LEN- it returns the number of characters, not bytes, and it is return same output for regular character or Unicode character string.
      it  remove trailing spaces

SELECT LEN(N'abc d ')  /*OUTPUT:5*/

2) DATALENGTH-returns the length of the input in terms of number of bytes and for Unicode character string, it will count 2 bytes
per character, it does not remove trailing spaces

SELECT DATALENGTH(N'abc d ')  /*OUTPUT:12*/

Tags:  DATALENGTH ,LEN


Nirav Gandhi
38 · 5% · 1567
3
 
0
Lifesaver
 
 
0
Learned
 
0
Incorrect



Submit

1  Comments  

  • Some additional info from http://msdn.microsoft.com/en-us/library/ms143726.aspx

    The following table compares the behavior of some string functions and string operators when they use supplementary characters with and without a SC collation.

    With an SC Collation - LEN - The UTF-16 surrogate pair is counted as a single codepoint. Without an SC Collation - LEN - The UTF-16 surrogate pair is counted as two codepoints.

    commented on Jun 20 2013 3:06AM
    Leszek Gniadkowski
    8 · 18% · 5729

Your Comment


Sign Up or Login to post a comment.

"what are Difference between DATALENGTH and LEN?" rated 5 out of 5 by 3 readers
what are Difference between DATALENGTH and LEN? , 5.0 out of 5 based on 3 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]