SQL-TSQL Functions

Source: Internet
Author: User

T-SQL functions

SQL Server built-in functions can be deterministic or indeterminate. If you call built-in functions at any time with a specific set of input values, the returned results are always the same, and these built-in functions are deterministic. If a built-in function is called each time it is used with the same set of specific input values and always returns different results, these built-in functions are indeterminate

650) this.width=650; "title=" 1.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M01/5C/2B/ Wkiom1ubvsoh-makaaggwh0srdw697.jpg "alt=" Wkiom1ubvsoh-makaaggwh0srdw697.jpg "/>

650) this.width=650; "title=" 2.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M02/5C/26/ Wkiol1ubvmlzo8ogaayw17vcgws433.jpg "alt=" Wkiol1ubvmlzo8ogaayw17vcgws433.jpg "/>


1) , character Conversion number of functions

2 ), go to space function

L LTRIM () the string Head the space is removed from the section.

Select LTRIM (' big ')

3 ), take the SUBSTRING function

L Left ()

Left (<character_expression>, <integer_expression>)

return character_expression from left integer_expression a character.

Select Left (' small_big ',4)

4 ), string ratio more function

L CHARINDEX ()

returns a specified substring in a string . now the starting position.

5 ), string manipulation functions

L QUOTENAME ()

Returns a string that is enclosed by a specific character.

6 ), Date function

pair date and time loss Enter value to hold row operation, then returns a string, number, or day period and Time Value

7 ), based on to be The parameters of the function provide the lose into value row operation, and then returns the number value

Name of function language Method say Ming

ABS ( number - valued expression ) Absolute Value .

8 ), Conversion Class Data Functions

there are two functions (CAST ()/convert) can move data from one dataclasstypeConversioninto another type of dataclass type. his ourthe difference is thatCAST ()haveANSI SQL-92the compatibility, whileCONVERT ()the work more for Strong Large .

9 ), aggregate functions:

Aggregation Functionsbyoften withSELECTlanguagesentence ofGROUP byclauses are used together. All aggregation functions areto beDeterminesex function, which issay, just use aGroupSpecialfixedloseintoValue Adjustmentwith aggregate functions,thefunctionTotalis to return the samevalue. it can betheaGroup of PractitionersLineCountcount, and return as avalue.

Function Name parameter description

AVG ([all| DISTINCT] expression) the mean value of the specified field in a mathematical expression , or

count All Record , or sub- Don't count counted the field on value not the same Record .


This article comes from the "Ricky's blog" blog, please be sure to keep this source http://57388.blog.51cto.com/47388/1627404

SQL-TSQL 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.