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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me when is the update_statistics command used?

514


what is the system function to get current user's user id? : Sql server database administration

554


In which files does sql server actually store data?

473


Explain logical operators in sql server?

572


What are subquery and its properties?

578






What is difference between delete & truncate commands?

554


What are the functions in sql server?

549


How to enter comments in transact-sql statements?

555


What does asynchronous call backs means?

625


What is a coalesce function?

669


How to create new tables with "select ... Into" statements in ms sql server?

518


You have modified 100 store procedures and want to replicate these changes from development to prodution, and production can have users using the Server/DB, how would you replicate without causing issues?

1726


How do you send email on SQL Server?

588


How to choose all records from the table?

659


Can you please explain the difference between function and stored procedure?

546