Solved

difference between datalength() and len()

Posted on 2008-10-03
4
1,562 Views
Last Modified: 2012-05-05
can i know what is difference between datalength() and len() functions in ms sql.
0
Comment
Question by:pavanark
4 Comments
 
LVL 37

Accepted Solution

by:
momi_sabag earned 168 total points
ID: 22632219
datalength returns number of bytes used by any expression
len returns number of characters in string expression
which means that for strings, if the string is unicode you might get a different result since each character can be represented using 2 bytes
for numeric expressions you can only use datalength
0
 
LVL 17

Assisted Solution

by:HuyBD
HuyBD earned 168 total points
ID: 22632220
datalength() returns the length of the string in bytes without trimming.
len() returns the length in characters with trimming
0
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 168 total points
ID: 22632452
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now