Sybase
Sybase ascii ( string_expression ) Returns a number representing the ascii code value of the leftmost character of "string_expression". Example: ascii ( 'A' ) Result: 65 char ( integer_expression ) Converts "integer_expression" to a character value. Char is usually used as the inverse of ascii where "integer_expression" must be between 0 and 255. If the resulting value is the first byte of a multibyte character, the character may be undefined. charindex ( string_expression1 , string_expression2 ) Returns an integer that represents the starting position of "string_expression1" within "string_expression2". If "string_expression1" is not found, zero is returned. If "string_expression1" contains wildcard characters, charindex treats them as literals. concat ( string_expression1 , string_expression2 ) Returns a string that is the result of concatenating, or joining, "string_expression1" to "string_expression2". Example: concat ( [Sales (query)].[Sales staff].[First name], [Sales (query)].[Sales staff].[Last name] ) Result: Returns the first name and family name; e.g., Bob Smith. datalength ( string_expression ) Returns the length in bytes of "string_expression". dateadd ( ' { ' datepart ' } ' , integer_expression , date_expression ) Returns the date resulting from adding "integer_expression" units indicated by datepart (day, month, year) to "date_expression". Note that "datepart" must be enclosed in curly brackets. Example: dateadd ( {dd} , 16 , 1997-06-16 ) Result: Jul 2, 1997 datediff ( ' { ' datepart ' } ' , date_expression1 , date_expression2 ) Returns the number of units indicated by "datepart" (day, month, year) between "date_expression1" and "date_expression2". Note that "datepart" must be enclosed in curly brackets. Example: datediff ( {yy} , 1984-01-01 , 1997-01-01 ) Result: 13 datename ( ' { ' datepart ' } ' , date_expression ) Returns "datepart" of "date_expression" as an ASCII string. "Date_expression" can be a datetime, smalldatetime, date, or time value. Note that "datepart" must be enclosed in curly brackets. Example: datename ( {mm} , 1999-05-01 ) Result: May datepart ( ' { ' datepart ' } ' , date_expression ) Returns "datepart" of "date_expression" as an integer. "Date_expression" can be a datetime, smalldatetime, date, or time value. Note that the datepart argument must be enclosed in curly brackets. Example: datepart ( {mm} , 1999-05-01 ) Result: 5 day ( date_expression ) Returns the day of the month (1-31) from "date_expression". difference ( string_expression1 , string_expression2 ) Returns an integer value representing the difference between the values returned by the data source-specific soundex function for "string_expression1" and "string_expression2". The value that is returned ranges from 0 to 4, with 4 indicating the best match. Note that 4 does not mean that the strings are equal. Example: difference ([Sales target (query)].[Sales staff].[First name],[Sales (query)].[Retailers].[Contact first name]) Result: 0 Example: difference ([Sales target (query)].[Sales staff].[First name],[Sales target (query)].[Sales staff].[First name]) Result: 4 getdate () Returns current system date and time. left ( string_expression , integer_expression ) Returns the leftmost "integer_expression" characters of "string_expression". Example: left ( [Sales (query)].[Sales staff].[Last name] , 3 ) Result: Returns the first three characters of each family name. ltrim ( string_expression ) Returns "string_expression" with any leading spaces removed. month ( date_expression ) Returns the month number (1-12) from "date_expression". patindex ( string_expression1 , string_expression2 [ using {bytes|chars|characters} ] ) Returns an integer representing the starting position of the first occurrence of "string_expression1" in "string_expression2" or returns 0 if "string_expression1" is not found. By default, patindex returns the offset in characters. The offset can be returned in bytes by setting the return type to bytes. The % wildcard character must precede and follow the pattern in "string_expression1", except when searching for first or last characters. rand ( integer_expression ) Returns a random float value between 0 and 1, using the optional "integer_expression" as a seed value. replicate ( string_expression , integer_expression ) Returns a string consisting of "string_expression" repeated "integer_expression" times. reverse ( string_expression ) Returns the reverse of "string_expression". right ( string_expression , integer_expression ) Returns the rightmost "integer_expression" characters of "string_expression". round ( numeric_expression, integer_expression ) Returns "numeric_expression" rounded to the nearest value "integer_expression" places to the right of the decimal point. Rounding takes place before data formatting is applied. Example: round (125, -1) Result: 130 rtrim ( string_expression ) Returns "string_expression" with trailing spaces removed. Example: rtrim ( [Sales (query)].[Sales staff].[Last name] ) Result: Returns family names with any spaces at the end of the name removed. soundex ( string_expression ) Returns a four-character soundex code for character strings that are composed of a contiguous sequence of valid single- or double-byte Roman letter. space ( integer_expression ) Returns a string with "integer_expression" single-byte spacing. str ( numeric_expression [ , integer_expression1 [ , integer_expression2 ] ] ) Returns a string representation of "numeric_expression". "Integer_expression1" is the length of the returned string and has a default setting of 10. "Integer_expression2" is the number of decimal digits and has a default setting of 0. Both are optional values. stuff ( string_expression1 , integer_expression1 , integer_expression2 , string_expression2 ) Deletes "integer_expression2" characters from "string_expression1" starting at "integer_expression1", and inserts "string_expression2" into "string_expression1" at that position. To delete characters without inserting other characters, "string_expression2" should be null and not " ", which indicates a single space. substring ( string_expression , integer_expression1 , integer_expression2 ) Returns the substring of "string_expression" that starts at position "integer_expression1". "Integer_expression2" specifies the number of characters in the substring. Example: substring ( [Sales (query)].[Sales staff].[Position code], 3 , 5 ) Result: Returns characters 3 to 7 of the position codes. to_unichar ( integer_expression ) Returns a unichar expression with the value "integer_expression". If "integer_expression" is in the range 0xD800..0xDFFF, the operation is aborted. If the "integer_expression" is in the range 0..0xFFFF, a single Unicode value is returned. If "integer_expression" is in the range 0x10000..0x10FFFF, a surrogate pair is returned. uhighsurr ( string_expression , integer_expression ) Returns 1 if the Unicode value at "integer_expression" is the high half of a surrogate pair (which should appear first in the pair). Otherwise, it returns 0. This function allows you to write explicit code for surrogate handling. Particularly, if a substring starts on a Unicode character where uhighsurr () is true, extract a substring of at least 2 Unicode values, as substr() does not extract just 1. Substr () does not extract half of a surrogate pair. ulowsurr ( string_expression , integer_expression ) Returns 1 if the Unicode value at "integer_expression" is the low half of a surrogate pair (which should appear second in the pair). Otherwise, it returns 0. This function allows you to explicitly code around the adjustments performed by substr (), stuff (), and right (). Particularly, if a substring ends on a Unicode value where ulowsurr () is true, extract a substring of 1 less characters (or 1 more), since substr () does not extract a string that contains an unmatched surrogate pair. uscalar ( string_expression ) Returns the Unicode scalar value for the first Unicode character in "string_expression". If the first character is not the high-order half of a surrogate pair, then the value is in the range 0..0xFFFF. If the first character is the high-order half of a surrogate pair, a second value must be a low-order half, and the return value is in the range 0x10000..0x10FFFF. If this function is called on a Unicode character expression containing an unmatched surrogate half, the operation is aborted. year ( date_expression ) Returns the year from date_expression.
Sybase Math log ( numeric_expression ) Returns the natural logarithm of "numeric_expression". log10 ( numeric_expression ) Returns the base ten logarithm of "numeric_expression". pi () Returns the constant value of pi as a floating point value. sign ( numeric_expression ) Returns an indicator denoting the sign of "numeric_expression": +1 if "numeric_expression" is positive, 0 if "numeric_expression" is zero, or -1 if "numeric_expression" is negative.
Sybase Trigonometry acos ( numeric_expression ) Returns the arccosine of "numeric_expression" in radians. The arccosine is the angle whose cosine is "numeric_expression". asin ( numeric_expression ) Returns the arcsine of "numeric_expression" in radians. The arcsine is the angle whose sine is "numeric_expression". atan ( numeric_expression ) Returns the arctangent of "numeric_expression" in radians. The arctangent is the angle whose tangent is "numeric_expression". atn2 ( numeric_expression1, numeric_expression2 ) Returns the angle, in radians, whose tangent is "numeric_expression1" / "numeric_expression2". cos ( numeric_expression ) Returns the cosine of "numeric_expression" where "numeric_expression" is an angle expressed in radians. cot ( numeric_expression ) Returns the cotangent of "numeric_expression" where "numeric_expression" is an angle expressed in radians. degrees ( numeric_expression ) Returns "numeric_expression" radians converted to degrees. radians ( numeric_expression ) Returns the degree equivalent of "numeric_expression". Results are of the same type as "numeric_expression". For numeric or decimal expressions, the results have an internal precision of 77 and a scale equal to that of "numeric_expression". When the money datatype is used, an internal conversion to float may cause some loss of precision. sin ( numeric_expression ) Returns the sine of "numeric_expression" where "numeric_expression" is an angle expressed in radians. tan ( numeric_expression ) Returns the tangent of "numeric_expression" where "numeric_expression" is an angle expressed in radians.