{"id":2342,"date":"2014-12-18T20:16:44","date_gmt":"2014-12-18T20:16:44","guid":{"rendered":"https:\/\/alt2.minisoft.com\/support\/?p=2342"},"modified":"2018-01-03T21:09:58","modified_gmt":"2018-01-03T21:09:58","slug":"using-sql-functions","status":"publish","type":"post","link":"https:\/\/email.minisoft.com\/support\/using-sql-functions\/","title":{"rendered":"(ODBC) Using SQL Functions"},"content":{"rendered":"<p>Function must be entered in escaped ODBC syntax. The functions are entered in the form<br \/>\n{fn function([parm_1[,parm_n]])}.<\/p>\n<p>For example:<\/p>\n<blockquote><p>select LAST_NAME, FIRST_NAME,<br \/>\n{fn CONCAT(FIRST_NAME,{fn CONCAT(&#8221; &#8220;,LAST_NAME)})}<br \/>\nfrom CUSTOMER<br \/>\nwhere {fn LEFT(LAST_NAME,1)}=&#8221;A&#8221;<\/p><\/blockquote>\n<hr align=\"center\" size=\"1\" \/>\n<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n<tbody>\n<tr>\n<td class=\"basic\" align=\"center\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">Function<\/td>\n<td class=\"basic\" valign=\"top\">Description<\/td>\n<\/tr>\n<tr>\n<th class=\"subheads\" colspan=\"2\" valign=\"middle\">String Functions<\/th>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">ASCII<\/td>\n<td class=\"basic\" valign=\"top\">Returns the ASCII code value of the leftmost character of string_exp as an integer.<br \/>\n{fn ASCII(string_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" align=\"center\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">CHAR<\/td>\n<td class=\"basic\" valign=\"top\">Returns a Character from the value of code (0 to 255).<br \/>\n{fn CHAR(code)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" align=\"center\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">CHAR_LENGTH<\/td>\n<td class=\"basic\" valign=\"top\">Returns the Length of the Character String.<br \/>\n{fn CHAR_LENGTH(string_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" align=\"center\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">CHARACTER_LENGTH<\/td>\n<td class=\"basic\" valign=\"top\">Returns the Length of the Character String.<br \/>\n{fn CHARACTER_LENGTH(string_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">CONCAT<\/td>\n<td class=\"basic\" valign=\"top\">Returns a Character String that consists of the two strings passed.<br \/>\n{fn CONCAT(string_exp1, string_exp2)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">INSERT<\/td>\n<td class=\"basic\" valign=\"top\">Returns a character string where length characters have been deleted from string_exp1 beginning at start and where string_exp2 has been inserted into string_exp1, beginning at start.<br \/>\n{fn INSERT(string_exp1, start, length, string_exp2)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">LCASE<\/td>\n<td class=\"basic\" valign=\"top\">Returns a string consisting only of lower case characters.<br \/>\n{fn LCASE(string_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">LEFT<\/td>\n<td class=\"basic\" valign=\"top\">Returns the number of characters requested from the left side of the given string.<br \/>\n{fn LEFT(string_exp,count)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">LENGTH<\/td>\n<td class=\"basic\" valign=\"top\">Returns the Length of the Character String.<br \/>\n{fn LENGTH(string_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">LOCATE<\/td>\n<td class=\"basic\" valign=\"top\">Returns the position of a substring within a string.<br \/>\n{fn LEFT (string_exp1,string_exp2[,start])}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">LTRIM<\/td>\n<td class=\"basic\" valign=\"top\">Returns a Character String except for any spaces on the left.<br \/>\n{fn LTRIM(string_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" align=\"center\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">OCTET_LENGTH<\/td>\n<td class=\"basic\" valign=\"top\">Returns the Length in bytes of the value.<br \/>\n{fn OCTET_LENGTH(string_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">REPEAT<\/td>\n<td class=\"basic\" valign=\"top\">Returns a given character the requested number of times.<br \/>\n{fn REPEAT(string_exp,count)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">REPLACE<\/td>\n<td class=\"basic\" valign=\"top\">Search str_exp1 for occurrences of str_exp2 and replace with str_exp3.<br \/>\n{fn LTRIM(str_exp1,str_exp2,str_exp3)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">RIGHT<\/td>\n<td class=\"basic\" valign=\"top\">Returns the rightmost count characters of string_exp. Returns the number of characters requested from the left side of the given string.<br \/>\n{fn RIGHT(string_exp,count)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">RTRIM<\/td>\n<td class=\"basic\" valign=\"top\">Returns the characters of string_exp with trailing blanks removed.<br \/>\n{fn LTRIM(string_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">SPACE<\/td>\n<td class=\"basic\" valign=\"top\">Returns a character string consisting of count spaces. Returns the number of characters requested from the left side of the given string.<br \/>\n{fn SPACE(count)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">SUBSTRING<\/td>\n<td class=\"basic\" valign=\"top\">Extracts one or more characters from a string. Returns the number of characters requested from the left side of the given string.<br \/>\n{fn SUBSTRING(string_exp,start,length)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">UCASE<\/td>\n<td class=\"basic\" valign=\"top\">Converts strings to uppercase. Returns the number of characters requested from the left side of the given string.<br \/>\n{fn UCASE(string_exp)}<\/td>\n<\/tr>\n<tr>\n<th class=\"subheads\" colspan=\"2\" valign=\"middle\">Numeric Functions<\/th>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">ABS<\/td>\n<td class=\"basic\" valign=\"top\">Returns the absolute value of numeric_exp.<br \/>\n{fn ABS(numeric_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">CEILING<\/td>\n<td class=\"basic\" valign=\"top\">Returns the smallest integer greater than or equal to numeric_exp. The return value is of the same data type as the input parameter.<br \/>\n{fn CEILING(numeric_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">FLOOR<\/td>\n<td class=\"basic\" valign=\"top\">Rounds a number down to the nearest (smallest) whole number.<br \/>\n{fn FLOOR(numeric_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">MOD<\/td>\n<td class=\"basic\" valign=\"top\">Returns the remainder (modulus) of integer_exp1 divided by integer_exp2.<br \/>\n{fn MOD(integer_exp1,integer_exp2)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">ROUND<\/td>\n<td class=\"basic\" valign=\"top\">Rounds a number (value1) down to the number of decimal digits specified in value2.<br \/>\n{fn ROUND(value1,value2)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">SIGN<\/td>\n<td class=\"basic\" valign=\"top\">Returns a value indicating the sign of the provided value.<br \/>\n{fn SIGN(value)}<\/td>\n<\/tr>\n<tr>\n<th class=\"subheads\" colspan=\"2\" valign=\"middle\">Date Functions<\/th>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">CURRENT_DATE<\/td>\n<td class=\"basic\" valign=\"top\">Returns the current host system date.<br \/>\n{fn CURRENT_DATE( )}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">CURDATE<\/td>\n<td class=\"basic\" valign=\"top\">Returns the current host system date.<br \/>\n{fn CURDATE( )}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">DAYOFMONTH<\/td>\n<td class=\"basic\" valign=\"top\">Returns a number that consists of the Day portion of a given date.<br \/>\n{fn DAYOFMONTH(date_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">MONTH<\/td>\n<td class=\"basic\" valign=\"top\">Returns a number that consists of the Month portion of a given date. Returns a number that consists of the Day portion of a given date.<br \/>\n{fn MONTH(date_exp)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">YEAR<\/td>\n<td class=\"basic\" valign=\"top\">Returns a number that consists of the Year portion of a given date. Returns a number that consists of the Day portion of a given date.<br \/>\n{fn YEAR(date_exp)}<\/td>\n<\/tr>\n<tr>\n<th class=\"subheads\" colspan=\"2\" valign=\"middle\">Misc Functions<\/th>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">ISNULL<\/td>\n<td class=\"basic\" valign=\"top\">Returns true if the value is NULL.<br \/>\n{fn ISNULL(value)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">ISNUMERIC<\/td>\n<td class=\"basic\" valign=\"top\">Returns true if the value represents a number.<br \/>\n{fn ISNUMERIC(value)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">COALESCE<\/td>\n<td class=\"basic\" valign=\"top\">Returns the first non-null value from the list provided. Used in joins that can return NULL values.<br \/>\n{fn COALESCE(value1,value2)}<\/td>\n<\/tr>\n<tr>\n<td class=\"basic\" valign=\"middle\" bgcolor=\"#EBEBEB\" width=\"79\">DECODE<\/td>\n<td class=\"basic\" valign=\"top\">Provides an IF THEN ELSE structure in the form,<br \/>\nif (column==test)then value1 else value2.<br \/>\n{fn DECODE(column,test,value1,value2)}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Function must be entered in escaped ODBC syntax. The functions are entered in the form {fn function([parm_1[,parm_n]])}. For example: select LAST_NAME, FIRST_NAME, {fn CONCAT(FIRST_NAME,{fn CONCAT(&#8221; &#8220;,LAST_NAME)})} from CUSTOMER where {fn LEFT(LAST_NAME,1)}=&#8221;A&#8221; Function Description String Functions ASCII Returns the ASCII code value of the leftmost character of string_exp as an integer. {fn ASCII(string_exp)} CHAR Returns a [&hellip;]<\/p>\n","protected":false},"author":75,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"_links":{"self":[{"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/2342"}],"collection":[{"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/comments?post=2342"}],"version-history":[{"count":4,"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/2342\/revisions"}],"predecessor-version":[{"id":6176,"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/2342\/revisions\/6176"}],"wp:attachment":[{"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/media?parent=2342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/categories?post=2342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/email.minisoft.com\/support\/wp-json\/wp\/v2\/tags?post=2342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}