Common Access Functions

Source: Internet
Author: User

▲Date/Time
Cdate converts a string into a date select cdate ("2005/4/5 ")
Date returns the current date
Dateadd adds a specified date to select dateadd ("D", 30, date () to add 30 days to the current date, where D can be converted to yyyy or H.
Datediff determines the interval between two dates select datediff ("D", "2006-5-1", "2006-6-1") returns 31, where D can be converted to yyyy, M, H, etc.
Datepart returns a part of the date. Select datepart ("D", "2006-5-1") returns 1, that is, 1, and D can also be converted to yyyy or M.
Day returns the D part of the date, which is equivalent to the D part of datepart.
Hour of the date returned by hour
Isdate determines whether it is a date. It is a date that returns-1, not a date that returns 0
Minute returns the minute of the date.
Month returns the month of the date.
Now returns the current time (complete time, including year, month, day, hour, minute, second)
Second returns the second part of the date.
Time returns the current time (except last year/month/day)
Weekday returns the current week of a date (Sunday is 1, Monday is 2, and Tuesday is 3...), for example, select weekday (now ());
Year returns the year of a date.

Check
Isempty checks whether it is null (however, no matter what the situation is, 0 is returned)
Isnull checks whether the value is null. If the value is null, 0 is returned. If the value is not null,-1 is returned.
Isnumeric checks whether it is a number. If it is a number,-1 is returned; otherwise, 0 is returned.

Arithmetic
ABS absolute value
Returns the tangent of ATN.
Cos cosine value
Exp returns the given power of E.
Fix returns the integer part of the number (that is, the fractional part is completely truncated)
Int rounded down the number to the nearest integer. (Actually equivalent to fix)
Log returns the base-e logarithm.
RND returns a random value between 0 and 1.
SGN returns the positive and negative signs of a number (positive returns 1, negative returns-returns 0)
Sin sine Value
Sqr returns the square root value.
Tan tangent

▲Procedure
Choose returns the value of the string group following the first parameter. Select choose (1, "A", "B", "C") returns a and 1 to 2, return B, change to 3, and return C (the first parameter can also be a field)
IIF returns a specific value select IIF ("3> 1", "OK", "false") based on the expression, and returns OK

▲Sql Aggregate functions
AVG obtains the average value of a field.
Count count
MAX: maximum value of a field
Min: obtain the minimum value of a field.
STDev estimates the standard deviation of the sample (ignore the logical value and text in the sample ).
Stdevp calculates the standard deviation of the entire sample population given in the form of parameters (ignoring logical values and text.
Sum calculation field sum
VaR estimates the sample variance (ignore the logical values and text in the sample ).
Varp calculates the variance of the entire sample population (ignore the logical values and text in the sample population ).

▲Text
ASC returns the acⅱ Value of the letter, and select ASC ("A") returns 65
CHR converts ASCII values to select CHR (65) and returns ""
Format formatted string, select format (now (), 'yyyy-mm-dd') returns a value similar to "", select format (3/9, "0.00") returns 0.33
Select instr ("ABC", "A") returns 1, select instr ("ABC", "F") returns 0
Lcase returns the string in lowercase.
Left truncated string
Len returns the string length
Ltrim left trim Space
Mid: Obtain the sub-string select mid ("123",) as middemo. 12 is returned.
Right: truncates a string.
Right trim space in rtrim
Space generates space select space (4) returns 4 spaces
Strcomp compares the two strings for content consistency (Case Insensitive) Select strcomp ("ABC", "ABC") returns 0, select strcomp ("ABC", "123") returns-1
Trim intercepts spaces at both ends of a string.
Ucase converts string to uppercase

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.