字串函數 (Transact-SQL)String Functions (Transact-SQL)

適用於: 是SQL Server 是Azure SQL Database 是Azure SQL 資料倉儲 是平行處理資料倉儲 APPLIES TO: yesSQL Server yesAzure SQL Database yesAzure SQL Data Warehouse yesParallel Data Warehouse

下列純量函數會執行一項作業來處理字串輸入值,並傳回字串或數值:The following scalar functions perform an operation on a string input value and return a string or numeric value:

ASCIIASCII CHARCHAR CHARINDEXCHARINDEX
CONCATCONCAT CONCAT_WSCONCAT_WS DIFFERENCEDIFFERENCE
FORMATFORMAT LEFTLEFT LENLEN
LOWERLOWER LTRIMLTRIM NCHARNCHAR
PATINDEXPATINDEX QUOTENAMEQUOTENAME REPLACEREPLACE
REPLICATEREPLICATE REVERSEREVERSE RIGHTRIGHT
RTRIMRTRIM SOUNDEXSOUNDEX SPACESPACE
STRSTR STRING_AGGSTRING_AGG STRING_ESCAPESTRING_ESCAPE
STRING_SPLITSTRING_SPLIT STUFFSTUFF SUBSTRINGSUBSTRING
TRANSLATETRANSLATE TRIMTRIM UNICODEUNICODE
UPPERUPPER

所有內建字串函式都具有確定性 (除 FORMAT 外)。All built-in string functions except FORMAT are deterministic. 這表示任何時間使用一組特定輸入值來呼叫它們,都會傳回相同的值。This means they return the same value any time they are called with a specific set of input values. 如需函數確定性的詳細資訊,請參閱決定性與非決定性函數For more information about function determinism, see Deterministic and Nondeterministic Functions.

將不是字串值的引數傳遞給字串函數時,輸入類型會隱含地轉換成文字資料類型。When string functions are passed arguments that are not string values, the input type is implicitly converted to a text data type. 如需詳細資訊,請參閱資料類型轉換 (資料庫引擎)For more information, see Data Type Conversion (Database Engine).

另請參閱See Also

內建函數 (Transact-SQL)Built-in Functions (Transact-SQL)