SQL Series functions--String functions

Source: Internet
Author: User
Tags rtrim

Tag: Convert specified BST index dex to specified position character ring capitalization

1. The CHARINDEX function is used to find the starting position of a specified character (string) in another string, returns an integer, returns 0 if not found

Select CHARINDEX (' sql ', ' Microsoft sql SERVER '), returning a result of 11

2. Len returns the length of the string

Select LEN (' Microsoft SQL SERVER '), returning a result of 20

3. Lower function converts uppercase of the given string to lowercase

Select LOWER (' SQL Server Course '), returning the result as "SQL Server Course"

4. The upper function converts the lowercase of the given string to uppercase

Select UPPER (' SQL Server Course '), returning the result as "SQL Server Course"

5, Itrim function to remove the left space of the string

Select LTrim (' SQL Server Course '), returning the result as "SQL Server Course"

6, RTrim function to remove the space to the right of the string

Select RTrim (' SQL Server Course '), returning the result as "SQL Server Course"

7. Left/right function returns the character of the specified bibliography from the left/right of the string

Select Left (' SQL Server Course ', 3), returning the result as "SQL". Select right (' SQL Server Course ', 3) returns the result as "course"

8. Replace function replaces characters in a string

Select REPLACE (' SQL Server Course ', ' Course ', ' test '), return the result as ' SQL Server Test '

9. Substring function splits the given string

Select SUBSTRING (' SQL Server ', 4,11), returning the result as "server"

10. The stuff function deletes a specified length of character from the specified position and inserts a new string at that location

Select STUFF (' SQL Server Course ', 12, 2, ' I removed the course, replaced it with a test ') and returned the result as "SQL Server I removed the course and replaced it with a test"

SQL Series functions--String functions

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.