What are the difference between data length and length in
SQL Server-2008?

Answers were Sorted based on User's Feedback



What are the difference between data length and length in SQL Server-2008?..

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

What are the difference between data length and length in SQL Server-2008?..

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

What are the difference between data length and length in SQL Server-2008?..

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

Post New Answer

More SQL Server Interview Questions

Explain the different types of joins?

0 Answers  


List some major differences between triggers and stored procedures?

0 Answers  


Advantages and Disadvantages of Cursor?

15 Answers   Polytechnic, TCS, Zenith,


What is cursor in ms sql server?

0 Answers  


but what if you have to create a database with two filegroups, one on drive c and the other on drive d with log on drive e with an initial size of 600 mb and with a growth factor of 15%? : Sql server database administration

0 Answers  






What are the different types of backups that exist?

0 Answers   ADITI,


How many types of Joins in SQL Server 2005?

9 Answers   CarrizalSoft Technologies, HCL,


What is auditing in sql server?

0 Answers  


Different Types of Functions ?

2 Answers   Satyam,


What is change data capture (cdc) feature?

0 Answers  


Explain differentiate between a having clause and a where clause?

0 Answers  


What will be the value of @@fetch_status if a row that was a part of the cursor resultset has been deleted from the database after the time the stored procedure that opened the cursor was executed?

0 Answers  


Categories