About 431,000 results
Open links in new tab
  1. SQL LENGTH Function - SQL Tutorial

    Here’s the syntax of the LENGTH function: If the input string is empty, the LENGTH returns 0. If it is NULL, the function returns NULL. The number of characters is the same as the number of bytes for ASCII strings. For other character sets, they may be different.

  2. Using LENGTH () Function in SQL - GeeksforGeeks

    Apr 16, 2024 · The syntax for the LENGTH() function in SQL is relatively straightforward: LENGTH(string) string : This is the input string for which you want to determine the length.

  3. sql - querying WHERE condition to character length? - Stack Overflow

    Dec 17, 2015 · In SQL Server (MS SQL), the LEN function will return number of characters but it will not count trailing spaces. So the solution might be to add non-space character at the end, and then subtract 1 from the result of LEN. Source (learn.microsoft.com/en-us/sql/t-sql/functions/…). I think you want this: FROM my_table.

  4. SQL Server LEN() Function - W3Schools

    Return the length of a string: The LEN () function returns the length of a string. Note: Trailing spaces at the end of the string is not included when calculating the length. However, leading spaces at the start of the string is included when calculating the length. Tip: Also look at the DATALENGTH () function. Required.

  5. How to Check the Length of a String in SQL | LearnSQL.com

    We can use the LENGTH() function to get the string length: And here is the result: LENGTH() returns the number of characters in a given string. It has only one parameter – the string itself. If the input string is empty, the function returns 0; if the string is …

  6. SQL LENGTH/LEN Function Guide, FAQ, and Examples - Database …

    Jun 9, 2023 · LENGTH returns the number of characters in the specified string, but VSIZE finds the number of bytes that a string uses. One byte does not always equal one character (related: character sets in Oracle).

  7. LEN (Transact-SQL) - SQL Server | Microsoft Learn

    Sep 3, 2024 · Use the LEN to return the number of characters encoded into a given string expression, and DATALENGTH to return the size in bytes for a given string expression. These outputs may differ depending on the data type and type of encoding used in the column.

  8. SQL Length syntax and example - T-SQL Tutorial

    It is commonly used in SELECT statements to retrieve the length of a column's data, but can also be used in other parts of a SQL statement, such as in a WHERE clause to filter results based on the length of the data. The syntax for the LEN function is as follows: where expression is the string value for which you want to return the length.

  9. How LENGTH works in SQL? Best LENGTH examples - KajoData

    What is the LENGTH Function in SQL? The LENGTH function in SQL returns the number of characters in a given string. This function is commonly used to assess data integrity, validate user inputs, and filter records based on string length. The syntax of the LENGTH function is straightforward: You can also use it with a literal string:

  10. SQL QUERY EXAMPLES

    SQL LENGTH function returns the number of characters in string, including blanks and other special character. An error will be returned if a value for the string argument is not provided. The syntax is : LENGTH (string) Example 1: The following SQL LENGTH function returns 4, which is the number of characters in input string:

Refresh