Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

datalength

Len() vs datalength() in SQL Server 2005

September 17, 2023 by Tarik

Be careful. DATALENGTH returns the number of bytes used, not the number of characters.

Categories sql-server Tags datalength, sql-server Leave a comment

count number of characters in nvarchar column

May 31, 2023 by Tarik

You can find the number of characters using system function LEN. i.e. SELECT LEN(Column) FROM TABLE

Categories sql Tags datalength, sql, sql-server-2008 Leave a comment

What is the size of a image field content in SQL Server?

April 7, 2023 by Tarik

SELECT DATALENGTH(imagecol) FROM table See MSDN

Categories sql-server Tags datalength, sql-server, tsql Leave a comment

SQL Server 2008 Empty String vs. Space

January 22, 2023 by Tarik

varchars and equality are thorny in TSQL. The LEN function says: Returns the number of characters, rather than the number of bytes, of the given string expression, excluding trailing blanks. You need to use DATALENGTH to get a true byte count of the data in question. If you have unicode data, note that the value … Read more

Categories sql-server Tags datalength, sql-server, sql-server-2008, string-length, tsql Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa