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.
LEN(
string)
Parameter | Description |
---|---|
string | Required. The string to return the length for. If string is NULL, it returns NULL |
Works in: | SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
Return the length of a string (counts leading spaces, but not trailing spaces):
SELECT LEN(' 91xjr.com ');
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!