Function

You are currently browsing articles tagged Function.

DATALENGTH returns the length of the string in bytes, including trailing spaces. LEN returns the length in characters, excluding trailing spaces. For example,

SELECT
  LEN('string'),
  LEN('string   '),
  DATALENGTH('string'),
  DATALENGTH('string   '),
  LEN(N'string'),
  LEN(N'string   '),
  DATALENGTH(N'string'),
  DATALENGTH(N'string   ')

will return 6, 6, 6, 9, 6, 6, 12, 18

from Arnold Fribble
Ref : SQLTeam

Tags: , , ,