Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Using String Functions

SQL Server 2000

String functions are used for various operations on character and binary strings, and they return values commonly needed for operations on character data. Most string functions can be used only on char, nchar, varchar, and nvarchar data types or the data types that implicitly convert to them. A few string functions can also be used on binary and varbinary data.

You can use string functions to:

  • Retrieve only a portion of a string (SUBSTRING).

  • Search for similarities in the sounds of a character string (SOUNDEX and DIFFERENCE).

  • Find a starting position for a particular string in a column or expression. For example, the position number of the letter A in "What a beautiful day!"

  • Concatenate strings into one string. For example, combining a first name, last name, and middle name or initial into a full name.

  • Convert a nonstring value to a string value (such as converting the value of 15.7 stored as a float to char).

  • Inserting a specific string into an existing string. For example, inserting the string "Once" into the existing string of "upon a time" to produce the string "Once upon a time".

When string functions operate on strings that have different collations, the collation of the result is determined using the rules of collation precedence. For more information, see Collation Precedence.

© 2015 Microsoft