Which MySQL function can be used to find out the length of the string in bits?

MySQLMySQLi Database

MySQL BIT_LENGTH() string function is used to get the length of the string in bits.

Syntax

BIT_LENGTH(Str)

Here Str, the argument of BIT_LENGTH() function, is the string whose BIT_LENGTH value is to be retrieved. Str can be a character string or number string. If it is a character string then it must be in quotes.

Example

mysql> Select BIT_LENGTH('New Delhi');

+-------------------------+
| BIT_LENGTH('New Delhi') |
+-------------------------+
| 72                      |
+-------------------------+

1 row in set (0.00 sec)

mysql> select BIT_LENGTH(123456);

+--------------------+
| BIT_LENGTH(123456) |
+--------------------+
| 48                 |
+--------------------+

1 row in set (0.00 sec)
raja
Published on 19-Feb-2018 14:01:32
Advertisements