Database Operations (iv), scalar functions

Source: Internet
Author: User
Tags rtrim scalar

Scalar functions

1, Uppercase: Upper ();

Select upper (column name) from table name;

2, lowercase: lower ();

Select lower (column name) from table name;

3, intercept the string: substring ();

Select substring (column name, from whom to start, intercept a few) from the table name;

4, the starting position of the specified string: charindex ();

Select CHARINDEX (' Value 1 ', column name, starting from a few) from table name;

' Value 1 ': Who to list: where to look

Select CHARINDEX (column name 1, column name 2, intercept several) from table name;

Compared to two columns

It can also be written in the Where condition to make its statement meaningful: SELECT * from table name where CHARINDEX (column name 1, column name 2, intercept several) >0;

5. Print length, go to the trailing space Len ();

Select Len (column name) from table name;

6, remove the left blank print value, LTrim ();

Select LTrim (column name) from table name;

Remove the right blank print value, RTrim ();

Select RTrim (column name) from table name;

7. Start capturing values from the leftmost column: Left ();

Select Left (column name, intercept several) from table name;

Intercept values from the rightmost of the column: Right ();

Select Right (column name, intercept several) from table name;

8, empty value: IsNull ();

Select IsNull (column name, ' xx ') from table name;

Note: If xx is empty, print empty

       

        

Database Operations (iv), scalar functions

Related Article

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.