Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Returns the number of bits in a string.
Syntax
bit_length(<string>)
Arguments
Required
<string>: The string to measure.
Returns
Returns an integer representing the number of bits in the string.
Considerations
- For UTF-8 strings, multi-byte characters contribute more bits proportionally.
- Each byte equals 8 bits.
Examples
Calculate Bit Length
Get the bit length of a string.
SELECT bit_length('jose') AS result;
Returns 32 (4 characters × 8 bits per byte).