SQL Server Function)

Source: Internet
Author: User
1. the string function ASCII () converts a character to an ascii code, ASCII ('abc') = 97 char (), and ASCII code to the characters low (), upper () STR (a, B, c) converts numbers to strings. A is the string to be converted. B Indicates the length after conversion, and C indicates the number of decimal places. STR (123.456, 123.46) = ltrim (), rtrim () Left (N), right (N), substring (STR, start, length) take the character string charindex (Child string, parent string) and check whether it contains the character string. Returns the location where the first occurrence occurs. The 0 patindex ('% pattern %', expression) function is the same as the previous one. However, the wildcard replicate ('Char ', rep_time) is used ), duplicate string reverse (char), reverse string Replace (STR, strold, strnew) replace string space (N), generate n blank lines stuff (), select stuff ('abcdef ', 2, 3, 'ijklmn ') = 'aijklmnef', 2 is the start position, 3 is the length of the character to be deleted from the original string, and ijlmn is the string to be inserted. 2. type Conversion Function: Cast, cast (expression as data_type), example: Select substring (title, 1, 30) as title, ytd_sales from titles where cast (ytd_sales as char (20 )) like '3% 'convert (data_type, expression) 3. date functions Day (), month (), Year () dateadd (datepart, number, date), datapart specifies that the part is added, number knows how much to add, date specifies the base on which to add. Datepart values include year, quarter, month, dayofyear, day, week, hour, minute, and second. For example, dateadd (day, 1, getdate () datediff (datepart, date1, date2 ). datapart is the same as above. The result of the function is the part of date2-date1 datename (datepart, date), and the string is returned. Datepart (datepart, date) is a part and an integer is returned. Getdate () current time 4. Statistical functions AVG, Count, Max, Min, Sum
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.