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

how to get the maximum among two tables,for example table 1 (dep1) have (emp_id,emp_name,salary) columns and table 2 (dept2) have (emp_id,emp_name,salary) columns,i want which employee have the maximum salary among two tables?

9 Answers   Deloitte, Lason,


How do you fine the performance tunning?

2 Answers   Accenture,


How do I create a stored procedure in sql server?

0 Answers  


Which language is supported by sql server?

0 Answers  


What are the types of table?

0 Answers  






What is mean by candidate key?

0 Answers  


What is sleeping status in sql server?

0 Answers  


how to find the second salary?

10 Answers   HCL, Prithvi,


What is surrogate key? : sql server analysis services, ssas

0 Answers  


Explain primary key, foreign key and unique key?

0 Answers  


Hi Friends, I have a table in which there are thousands of records and in city field there is NULL value for all records now i want to change that null value with distinct values in each record say delhi, bihar, agra, jaipur etc, what will be the query for that????? its not possible to update thousands of records one by one. is there any alternative ...? Plz help ... its urgent Thanx in advance

1 Answers  


what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration

0 Answers  


Categories