Summary of common built-in functions

Source: Internet
Author: User
Character string date math others: isnull convert row_number select Len ('dshgjkdhsad ') returns the number of characters in the specified string expression, excluding trailing spaces. Itrim ('anc skkmkls') returns the string expression after the leading space is deleted. Select rtrim ('abc ') returns the string expression select Len (itrim ('anc skkmkls') after trailing spaces are deleted. It is used in combination with select Replace ('abcttabchhabc', 'abc', '123 ') string expression 3 replaces all matching items of string expression 2 in string expression 1, and returns the new string substring (string expression, start position, length) Select substring ('abcdef ', 2, 2) return BC return the sub-string select charindex ('ss', 'eefssvss ', 5) Find string 1 in string 2. If yes, return the first matched position, if no value exists, 0 is returned. If either string 1 or string 2 is null, null is returned. You can specify the start position for searching in string 2. Upper

Returns a string expression that converts lowercase data to uppercase.

Select getdate () The current system date and time select dateadd (day, 220, getdate () based on adding a period of time to the specified date, return the new datetime value -- calculate the age select datediff (year, '2017-09-27 ', getdate (); returns the number of date and time boundary numbers across two specified dates. -- Calculate the number of people of age select count (datediff (year, '2017-09-27 ', getdate (); -- random number rand () * select floor (RAND () * 10) random number between 10 and 10 returns the maximum integer less than or equal to the given numeric expression, ignoring the remainder select power (5, 3) returns the value of the given expression multiplied by the specified power. -- Replace null with the specified replacement value select isnull (null, 1000) isnull (Comm, 0). If not null, comm is returned; otherwise, return 0. Select 'my scores: '+ convert (char (20), 100) convert 100 to char type

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.