SQL Server/T-SQL Tutorial/String Functions/LEN

Материал из SQL эксперт
Перейти к: навигация, поиск

Determining the Number of Characters or Bytes in a String by using LEN

3>
4> SELECT LEN(N"www.sqle.ru. sqle")
5> GO
-----------
         22
(1 rows affected)


LEN Returns the length of a string as an integer.

3>
4> DECLARE @LEN_STRING varchar(100)
5> SET @LEN_STRING = "www.sqle.ru"
6>
7> SELECT LEN(@LEN_STRING)
8> GO
-----------
         14
(1 rows affected)


select LEN("SQL Server")

2>
3> select LEN("SQL Server")
4> GO
-----------
         10
(1 rows affected)
1>


select LEN(" SQL Server ") (space at both ends)

3> select LEN(" SQL Server ")
4> GO
-----------
         11
(1 rows affected)