1. 程式人生 > >SQL Server擷取字串和處理中文技巧

SQL Server擷取字串和處理中文技巧

ArgumentsexpressionToFindIs a character expression that contains the sequence to be found. expressionToFind is limited to 8000 characters.expressionToSearchIs a character expression to be searched.start_locationIs an integer or bigint expression at which the search starts. If start_location is not specified, is a negative number, or is 0, the search starts at the beginning of expressionToSearch.
Return Typesbigint if expressionToSearch is of the varchar(max), nvarchar(max), or varbinary(max) data types; otherwise, int.RtrimReturns a character expression after removing trailing spaces.RTRIM does not remove white space characters such as the tab or line feed characters. Unicode provides code points for many different types of spaces, but this function recognizes only the Unicode code point 0x0020. When double-byte character set (DBCS) strings are converted to Unicode they may include space characters other than 0x0020 and the function cannot remove such spaces. To remove all kinds of spaces, you can use the Microsoft Visual Basic .NET RTrim method in a script run from the Script component.
SyntaxRTRIM(character expression)Argumentscharacter_expressionIs a character expression from which to remove spaces.Result TypesDT_WSTRLtrimReturns a character expression after removing leading spaces.LTRIM does not remove white-space characters such as the tab or line feed characters. Unicode provides code points for many different types of spaces, but this function recognizes only the Unicode code point 0x0020. When double-byte character set (DBCS) strings are converted to Unicode they may include space characters other than 0x0020 and the function cannot remove such spaces. To remove all kinds of spaces, you can use the Microsoft Visual Basic .NET LTrim method in a script run from the Script component.
SyntaxLTRIM(character expression)Argumentscharacter_expressionIs a character expression from which to remove spaces.Result TypesDT_WSTR