SQL API — JDBC-Only Supported Functions and Clauses<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } body { font-family: Arial, sans-serif; font-size: 14px; color: #1d1d1d; max-width: 960px; margin: 40px auto; padding: 0 24px; line-height: 1.6; } p { margin: 10px 0; } ul, ol { margin: 8px 0 8px 24px; } li { margin-bottom: 4px; } table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 13px; } th { background-color: #f0f0f0; text-align: left; padding: 8px 10px; border: 1px solid #ccc; } td { padding: 7px 10px; border: 1px solid #ccc; vertical-align: top; } tr:nth-child(even) { background-color: #fafafa; } .warning { background-color: #fff8e1; border-left: 4px solid #f5a623; padding: 10px 14px; margin: 16px 0; border-radius: 2px; } .warning strong { color: #b36200; } .note { background-color: #f5f5f5; border-left: 4px solid #999; padding: 10px 14px; margin: 10px 0; font-size: 13px; border-radius: 2px; } hr { border: none; border-top: 1px solid #ddd; margin: 28px 0; } This article lists the SQL functions and clauses that are supported when using the ServiceNow SQL API with the JDBC driver but are not supported with the ODBC driver. If you are using the ODBC driver and a query that uses any of these functions or clauses fails, this is expected behavior — these operations are not available over ODBC. Note: The functions and clauses listed below work only with the JDBC driver. They are not supported with the ODBC driver. If your use case requires any of these, you must use the JDBC driver to connect to the SQL API. Functions and Clauses Supported in JDBC Only CategoryFunction / ClauseDescriptionOperators<>Performs a logical exclusive OR operation.ClausesEXCEPTReturns rows from the first query that are not present in the second query.ClausesINTERSECTReturns only the rows that are common to both result sets.ClausesLIMITRestricts the number of rows returned by a query. Use this to control result set size and avoid timeouts.Aggregate FnAVG DISTINCTReturns the average of distinct (unique) values only, ignoring duplicates.Aggregate FnBOOL ANDReturns true only if all input boolean values are true; returns false if any value is false.Aggregate FnBOOL ORReturns true if at least one input boolean value is true; returns false only if all values are false.Aggregate FnSTDDEVReturns the standard deviation of the input values.Aggregate FnSTDDEV_POPReturns the population standard deviation, calculated over all values in the group.Aggregate FnSTDDEV_SAMPReturns the sample standard deviation, calculated over a subset of values in the group.Aggregate FnSUM DISTINCTReturns the sum of distinct (unique) values only, ignoring duplicates.Aggregate FnVAR_POPReturns the population variance, calculated over all values in the group.Aggregate FnVAR_SAMPReturns the sample variance, calculated over a subset of values in the group.String FN!~ (not match)Returns true if the string does not match the given regular expression (case-sensitive).String FN!~* (not match ci)Returns true if the string does not match the given regular expression (case-insensitive).String FN|| (concat)Concatenates two or more strings into a single string using the pipe operator.String FN~ (regex)Returns true if the string matches the given regular expression (case-sensitive).String FN~* (regex ci)Returns true if the string matches the given regular expression (case-insensitive).String FNCASTExplicitly converts a value from one data type to another. For example, converting a string to an integer or a date.String FNCHRReturns the character corresponding to the given ASCII code. For example, CHR(65) returns 'A'.String FNCONCATConcatenates two or more strings into a single string.String FNCONVERT_FROMConverts a binary string from a specified encoding (such as UTF-8) to the database's default encoding.String FNDECODEDecodes a binary string that was encoded using ENCODE, converting it back to its original form.String FNENCODEEncodes binary data into a text representation using a specified format such as hex or base64.String FNILIKEPerforms case-insensitive pattern matching, similar to LIKE but ignoring letter case.String FNn::bit(32)::textCasts an integer to a 32-bit binary representation and returns it as a text string.String FNNOT REGEXPReturns true if the string does not match the given regular expression pattern.String FNOVERLAYReplaces a portion of a string with another string, starting at a specified position.String FNPOSITIONReturns the starting position of a substring within a string. Returns 0 if the substring is not found.String FNREGEX (~)Returns true if the string matches the given regular expression pattern.String FNREPEATReturns the input string repeated a specified number of times.String FNROUNDRounds a numeric value to the nearest integer or to a specified number of decimal places.String FNSUBSTRINGExtracts a portion of a string starting from a specified position, with an optional length.String FNTO_DATEConverts a string to a date value using a specified format pattern. For example, TO_DATE('2024-01-15', 'YYYY-MM-DD').String FNTO_NUMBERConverts a string to a numeric value using a specified format pattern.String FNTO_TIMESTAMPConverts a string to a timestamp value using a specified format pattern.DateTime FNCURRENT_DATEReturns the current date without the time component.DateTime FNCURRENT_TIMEReturns the current time without the date component.DateTime FNCURRENT_TIMESTAMPReturns the current date and time including the time zone.DateTime FNDATE_ADD (+)Adds a specified time interval (such as days or months) to a date and returns the resulting date.DateTime FNDATE_SUBTRACT (-)Subtracts a specified time interval from a date and returns the resulting date.DateTime FNEXTRACTExtracts a specific part from a date or time value, such as year, month, day, or hour.DateTime FNJUSTIFY_DAYSNormalizes an interval by converting days exceeding a full month into months.DateTime FNJUSTIFY_HOURSNormalizes an interval by converting hours exceeding a full day into days.Numeric FNGET_BITReturns the value (0 or 1) of a specific bit at a given position in a bit string.Numeric FNGET_BYTEReturns the value of a specific byte at a given position in a binary string.Numeric FNLOG(base, x)Returns the logarithm of x for the specified base. For example, LOG(10, 100) returns 2.Numeric FNRADIANSConverts a numeric value from degrees to radians.Windows FNCUME_DIST()Returns the cumulative distribution of a value within its partition — the fraction of rows with values less than or equal to the current row's value.Windows FNFIRST_VALUE()Returns the value of the specified expression for the first row in the current window frame.Windows FNLAG()Returns the value of the specified expression from a row a given number of positions before the current row.Windows FNLAST_VALUE()Returns the value of the specified expression for the last row in the current window frame.Windows FNLEAD()Returns the value of the specified expression from a row a given number of positions after the current row.Windows FNNTILE()Divides the rows in a partition into a specified number of equal-sized buckets and assigns a bucket number to each row.Windows FNPERCENT_RANK()Returns the relative rank of a row within its partition as a value between 0 and 1.OtherSET_BITSets the bit at a specified position in a bit string to a given value (0 or 1) and returns the modified string.OtherSET_BYTESets the byte at a specified position in a binary string to a given value and returns the modified string.XML FNXPATH_EXISTSEvaluates an XPath expression against an XML value and returns true if the expression matches any nodes, false otherwise.