In MySQL you can use the BIN()
function to return a binary representation of a number. This function actually returns a string representation of the binary value.
Author: Ian
How to Get the Number of Bits in a String in MySQL – BIT_LENGTH()
MySQL has a BIT_LENGTH()
function that allows you to get the length of a string, measured in bits.
This function is similar to the LENGTH()
function, which returns the length of a string in bytes. The same is true for the OCTET_LENGTH()
function, which is a synonym for the LENGTH()
function.
How to Find the ASCII Code for a given Character in MySQL
In MySQL, you can use the ASCII()
function to return the ASCII code for a given character. More specifically, it returns the ASCII code for the leftmost character in a given string.
You can also use ORD()
, which works the same way, except that it also supports multibyte characters.
How to Return the Unicode Value for a given Character in SQL Server – UNICODE()
One of the functions included in T-SQL is the UNICODE()
function. You can use this function with SQL Server (and Azure) to return the Unicode value of a given character.
This function works similar to the ASCII()
function, except that it returns the Unicode value.
How to Return the ASCII Code Value for a given Character in SQL Server
If you ever need to find the ASCII code for a given character when using SQL Server, the T-SQL ASCII()
function is probably what you need.
The ASCII()
function returns the ASCII code value of the leftmost character of a character expression. Simply provide the character as an argument and SQL Server will return the ASCII value of that character (or the leftmost character in the string).
SQL Server REPLACE() vs TRANSLATE(): What are the Differences?
Starting with SQL Server 2017, you can now use the T-SQL TRANSLATE()
function to translate one or more characters into another set of characters.
At first glance, you might think that the TRANSLATE()
function does exactly the same thing as the REPLACE()
function, but there are significant differences between the two.
How to Convert Lowercase to Uppercase in SQL Server – UPPER()
In SQL Server, you can convert any lowercase string to uppercase by using the UPPER()
function.
To use it, simply pass the string as an argument when calling the function.
How to Convert Uppercase to Lowercase in SQL Server – LOWER()
In SQL Server, you can convert any uppercase string to lowercase by using the LOWER()
function.
Simply provide the string as an argument when you call the function, and it will be returned in lowercase form.
How to Convert Uppercase Characters to Lowercase in MySQL
In MySQL, you can use the LOWER()
function to convert any uppercase characters to lowercase. Alternatively, you can use the LCASE()
function, which is a synonym for LOWER()
.
The syntax goes like this:
LOWER(str)
Or…
LCASE(str)
Where str
is the string you want converted to lowercase.
How to Convert Lowercase Characters to Uppercase in MySQL
In MySQL, you can use the UPPER()
function to convert any lowercase characters to uppercase. Alternatively, you can use the UCASE()
function, which is a synonym for UPPER()
.
The syntax goes like this:
UPPER(str)
Or…
UCASE(str)
Where str
is the string you want converted to uppercase.