Sql Server中經常使用的字符串函數

len(expression) 返回給定字符串表達式的字符(而不是字節)個數,其中不包含尾隨空格。html

datalength(Char_expr) 返回字符串包含字符數,但不包含後面的空格
length(expression,variable)指定字符串或變量名稱的長度。
substring(expression,start,length) 很少說了,取子串
right(char_expr,int_expr) 返回字符串右邊int_expr個字符
concat(str1,str2,...)返回來自於參數連結的字符串。
express

datalength(Char_expr) 返回字符串包含字符數,但不包含後面的空格
length(expression,variable)指定字符串或變量名稱的長度。
substring(expression,start,length) 很少說了,取子串
right(char_expr,int_expr) 返回字符串右邊int_expr個字符
concat(str1,str2,...)返回來自於參數連結的字符串。
函數


字符操做類spa


upper(char_expr) 轉爲大寫
lower(char_expr) 轉爲小寫
UCase(string) 返回 Variant (String),其中包含轉成大寫的字符串。
LCase(string) 返回字符串的小寫形式。
space(int_expr) 生成int_expr個空格
replicate(char_expr,int_expr) 複製字符串int_expr次
reverse(char_expr) 反轉字符串
stuff(char_expr1,start,length,char_expr2) 將字符串char_expr1中的從 start開始的length個字符用char_expr2代替
ltrim(char_expr) rtrim(char_expr) 去掉空格
ascii(char) char(ascii) 兩函數對應,取ascii碼,根據ascii嗎取字符htm


字符串查找ci


charindex(char_expr,expression) 返回char_expr的起始位置
patindex("%pattern%",expression) 返回指定模式的起始位置,不然爲0
locate(substr,str,pos) 返回子串substr在字符串str第一個出現的位置字符串



參考資料: Sql Server中經常使用函數   http://www.studyofnet.com/news/1007.html get

相關文章
相關標籤/搜索