SQL string function Encyclopedia (1/3)

Source: Internet
Author: User

SQL string function Encyclopedia, including many such as go to the space function to take a substring function string comparison function string manipulation function data type conversion function Date function
And so on the operation has a detailed description ah.

Go to the Space function
1, LTrim () The string head of the space removed.

2, RTrim () The end of the string to remove the space.

Three, take the SUBSTRING function
1, left ()
Left (<CHARACTER_EXPRESSION> <integer_expression>)
Returns the character_expression left integer_expression character.

2, right ()
Right (<CHARACTER_EXPRESSION> <integer_expression>)
Returns the character_expression right integer_expression character.

3, SUBSTRING ()
SUBSTRING (<expression>, <starting_ position>, length)
Returns the portion of Fu Qi length characters from the left-starting_ position character of the string.

Four, string comparison function
1, CHARINDEX ()
Returns the starting position of the occurrence of a specified substring in a string.
CHARINDEX (< ' substring_expression ', <expression>)
Where substring _expression is the character expression to look for, expression can be a string or a column-name expression. If no substring is found, a value of 0 is returned.
This function cannot be used for text and image data types.
2, Patindex ()
Returns the starting position of the occurrence of a specified substring in a string.
Patindex (< '%substring _expression% ', <column_ name>) The substring expression must be preceded by a percent semicolon "%" or the return value is 0.
Unlike the CHARINDEX function, wildcard characters can be used in substrings of patindex functions, and this function can be used for char, varchar, and text data types.

Home 1 2 3 last

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.