Tuesday, 23 October 2012

Functions available to create EXPRESSIONS



Functions available to create EXPRESSIONS


Mathematical Functions
FUNCTION
Result
DataType
ROUND( 2.23 , 2 )
2
Integer
ROUND( 2.53 , 2 )
3
Integer
CEILING(2.23 )
3
Numeric
FLOOR(2.9)
2
Numeric
ABS(3.2)
3
Numeric
ABS(3.9)
4
Numeric
ABS(-3.2)
3
Numeric
ABS(-3.9)
4
Numeric

String Functions
FUNCTION
Result
DataType
LOWER( "ABD" )
abc
String
UPPER( "abd" )
ABD
String
LTRIM( "    abc   " )
"abc   "
String
RTRIM( "   abc   " )
"   abc"
String
TRIM( "   abc   " )
"abc"
String
REVERSE( "abc" )
"cba"
String
RIGHT( abc, 2 )
"bc"
String
SUBSTRING( "abcde", 2 , 3 )
"bcd"
String
REPLICATE("a",3)
"aaa"
String
FINDSTRING("abcd","ab",1)
"ab"
String
REPLACE("Apple", "pp", "n app")
"An apple"
String

Date/Time Functions
FUNCTION
Result
DataType
DATEADD( "mm", 1, (DT_DATE)"12/24/2009" )
1/24/2010 0:00
DateTime
DATEADD( "dd", -1, (DT_DATE)"12/24/2009" )
12/23/2009 0:00
DateTime
DATEADD( "yy", 1, (DT_DATE)"12/24/2009" )
12/24/2010 0:00
DateTime
DATEDIFF( "dd", (DT_DATE)"12/24/2009", DT_DATE)"01/26/2010" )
33
Integer
DATEDIFF( "mm", (DT_DATE)"12/24/2009", (DT_DATE)"01/26/2010" )
1
Integer
DATEDIFF( "yy", (DT_DATE)"12/24/2009", (DT_DATE)"01/26/2010" )
1
Integer
DATEPART( "dd", (DT_DATE)"12/24/2009" )
24
Integer
DATEPART( "mm", (DT_DATE)"12/24/2009" )
12
Integer
DATEPART( "yy", (DT_DATE)"12/24/2009" )
2009
Integer
DAY( (DT_DATE)"12/24/2009" )
24
Integer
MONTH( (DT_DATE)"12/24/2009" )
12
Integer
YEAR( (DT_DATE)"12/24/2009" )
2009
Integer

NULL Functions
FUNCTION
Result
DataType
ISNULL( «expression» )
TRUE/FALSE
Boolean
NULL(DT_DATE)
NULL
DateTime

Type Casts
FUNCTION
(DT_STR, «length», «code_page»)
(DT_WSTR, «length»)
(DT_NUMERIC, «precision», «scale»)
(DT_DECIMAL, «scale»)

Operators
FUNCTION
Comments
?:
 If then Else -> "Condition"?"True Action" : "False Action"
&&
Logical AND
||
Logical OR

No comments:

Post a Comment