LEN() 函式
LEN 函式回傳文本欄位中值的長度,
SQL LEN() 語法
SELECT LEN(column_name) FROM table_name
SQL LEN() 實體
我們擁有下面這個 "Persons" 表:
| Id | LastName | FirstName | Address | City |
|---|---|---|---|---|
| 1 | Adams | John | Oxford Street | London |
| 2 | Bush | George | Fifth Avenue | New York |
| 3 | Carter | Thomas | Changan Street | Beijing |
現在,我們希望取得 "City" 列中值的長度,
我們使用如下 SQL 陳述句:
SELECT LEN(City) as LengthOfCity FROM Persons
結果集類似這樣:
| LengthOfCity |
|---|
| 6 |
| 8 |
| 7 |
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/36963.html
標籤:SQL Server
上一篇:linux安裝資料時報錯Could not execute auto check for display colors using command /usr/bin/xdpyinfo.
下一篇:SQLSEVER匯出 xml檔案
