What are the difference between data length and length in
SQL Server-2008?
Answers were Sorted based on User's Feedback
Answer / sapthagiri
LEN
Returns the number of characters, rather than the number of bytes, of the given string expression, excluding trailing blanks.
DATALENGTH
Returns the number of bytes used to represent any expression.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / bindu
The DATALENGTH function counts both trailing spaces and preceeding spaces when calculating the length of the expression.
The DATALENGTH function will return NULL, if the expression is NULL.
The LEN function does NOT count trailing spaces at the end of the string when calculating the length of the string.
The LEN function does count spaces at the start of the string when calculating the length of the string.
The LEN function will return NULL, if the string is NULL.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / rajkumar
If the string has the space before the like
select LEN(' raj')
select dataLENgth(' raj')
Both consider the space.
but space is after the string len is not bother about space it wil be trucated.
datalenth counted with space.
Is This Answer Correct ? | 2 Yes | 0 No |
Comment,Datatypes are unlimited
Explain throw statement in sql server 2008?
how you can move data or databases between servers and databases in sql server? : Sql server administration
Can we call future method from trigger?
What are information schema views?
What is the difference between local table and global table
1 Answers CarrizalSoft Technologies, Polaris,
How do I partition a table in sql server?
how to dispaly a particular row details from a given table
Can a stored procedure call itself or a recursive stored procedure? How many levels of sp nesting is possible?
What is indexing explain it with an example?
What is the default value of an integer data type in sql server 2005?
What is the difference between varchar and varchar types?