字符串函数 (Transact-SQL)String Functions (Transact-SQL)

适用于: 是SQL Server 是Azure SQL 数据库 是Azure Synapse Analytics (SQL DW) 是并行数据仓库 APPLIES TO: YesSQL Server YesAzure SQL Database YesAzure Synapse Analytics (SQL DW) 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)