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 |
What are functions
What is the difference between a check constraint and a rule?
Questions on identity?
How to create a testing table with test data in ms sql server?
What are the advantages of using third-party tools?
Define candidate key, alternate key, composite key.
13 Answers Infosys, Software India,
What is meant by Active-Passive and Active-Active clustering setup?
How you can get the list of largest tables in a database?
Explain the cursor lock types?
What is the difference between online clustering and Offline clustering?
How to know the NAME of the Database and SIZE of the Database at the client node in Sql Server 2005
How many types of cursors are there in SQL Server?
5 Answers 247Customer, CarrizalSoft Technologies,
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)