S: string parameter; d: integral type parameter; f:float type parameter
One, the string function
ASCII (' xxx ') returns the ASCII code of the leftmost character in the string, example: Select ASCII (' Charles ') returns the ASCII code of ' C '
char (' xxx ') converts the ASCII code to a character with a range of values 0~255
charindex (s1,s2[,d]) find S1 in S2, return first match position, cannot find return 0, have one null return NULL
difference (S1,S2) returns an integer value from 0 to 4 that indicates the similarity between two character expressions, and the larger the number, the more similar
Left (s,d) returns the specified number of characters in the string
Right (s,d) returns the specified number of characters in the string
Len (s) returns the number of characters of the specified string expression, with no trailing spaces
Lower (s) returns a lowercase string
Upper (s) returns an uppercase string
LTrim (s) returns a string that removes the opening space
RTrim (s) returns a string that removes the trailing space
patindex (S1,S2) returns the position of S1 that appears in S2, no return 0;s1 can have wildcards,%: any number of characters; _: any one character
reverse (s) returns the new string after the specified string is reversed
Space (d) returns the specified number of spaces
str (F[,D1[,D2]]) float number is converted to a string, D1 represents the total length of the string, D2 represents the number of digits retained after the decimal point. Returns the number of characters less than the total length of the preceding fill space, which exceeds the total length of the truncated decimal place. Returns * * If truncation of integer digits is required. Rounding is followed when truncating. The total length includes decimal points, symbols, numbers, and spaces. The default value is 10. Retain up to 16 digits after the decimal point, the number after the decimal point is not preserved by default
Stuff (S1,D1,D2,S2) deletes the S1 string from the D1 position d2 length, adding S2 string, example: Select Stuff (' abcdef ', 2, 2, ' 123 ') return A123def
substring (S,D1,D2) returns the length of the string s from the D1 position, starting at D2. Example: Select substring (' abcdef ', 2,2) returns BC
Replace (S1,S2,S3) returns the new string after replacing all occurrences of the S2 string in the S1 string with S3. Example: Select replace (' ABCTTABCHHABC ', ' abc ', ' 123 ') returns 123tt123hh123
Reprint: http://blog.csdn.net/travylee/article/details/7216481
SqlServer2008 Common functions