tailieunhanh - Using Functions phần 2

You use the POWER() function to get the value of a number raised to a specified power. The following example returns 8: SELECT POWER(2, 3) | You use the POWER function to get the value of a number raised to a specified power. The following example returns 8 SELECT POWER 2 3 You use the ROUND function to get the value of a number rounded or truncated to a specified length. The following example returns which is rounded to three decimal places SELECT ROUND 3 The next example passes a non-zero number as the third parameter to ROUND which indicates that the number is to be truncated rather than rounded as was done in the previous example SELECT ROUND 3 1 This example returns which is truncated to three decimal places. You use the SQUARE function to get the square of a number. The following example returns SELECT SQUARE 4 You use the SQRT function to get the square root of a number. The following example returns SELECT SQRT 16 Using String Functions The string functions allow you to manipulate strings. For example you can replace specified characters in a string. Table lists the string functions available in SQL Server. Table STRING FUNCTIONS FUNCTION DESCRIPTION ASCII charExpression Returns the ASCII code for the leftmost character of charExpression. CHAR intExpression Returns the character that corresponds to the ASCII code specified by intExpression. CHARINDEX charExpressionl Returns the position of the characters specified by Table STRING FUNCTIONS FUNCTION DESCRIPTION charExpression2 start charExpressionl in charExpression2 starting at the optional position specified by start. DIFFERENCE charExpressionl charExpression2 Returns the difference between the SOUNDEX values of the two character expressions. You use the SOUNDEX code to evaluate the phonetic similarity of two strings. The returned value is between 0 and 4 4 indicates that the two expressions are phonetically identical. LEFT charExpression intExpression Returns the leftmost characters specified by intExprssion from charExpression. LEN charExpression Returns the number of .

TÀI LIỆU LIÊN QUAN
10    158    1
6    184    1
7    162    1
5    157    1
6    160    1
6    152    1
6    150    1
6    206    1
7    154    1
5    121    1