AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
SQL Length Function |
|
SQL > SQL String Functions >
Length Function
The Length function in SQL is used to get the length of a string. This function has a different name for different databases:
SQL LENGTH (or LEN in SQL Server) returns the number of characters in a string—useful for data validation, filtering by string size, and computed columns. Note that SQL Server's LEN() does not count trailing spaces, while MySQL and Oracle's LENGTH() does.
SyntaxThe syntax for the Length function is as follows:
The length of the string str is returned. ExamplesWe use the following table for our examples. Table Geography
Example 1
Result:
Example 2
Result:
Frequently Asked QuestionsQ: What does the SQL LENGTH function do? Q: What is the difference between LENGTH and LEN in SQL? Q: Does SQL LENGTH count spaces? Q: How can I find rows where a string column exceeds a certain length?
|
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.