Solved

difference between datalength() and len()

Posted on 2008-10-03
4
1,565 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 70

Assisted Solution

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

828 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