13.07.2015 Views

Caché Transact-SQL (TSQL) Migration Guide - InterSystems ...

Caché Transact-SQL (TSQL) Migration Guide - InterSystems ...

Caché Transact-SQL (TSQL) Migration Guide - InterSystems ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Supported Functions6.1.10 CHAR_LENGTH / CHARACTER_LENGTHCHAR_LENGTH(string)CHARACTER_LENGTH(string)Returns the number of characters in string.6.1.11 CHARINDEXCHARINDEX(seekstring,target[,startpoint])Returns the position in target (counting from 1) corresponding to first character of the first occurrence of seekstring. Youcan use the optional startpoint integer to specify where to begin the search. The return value counts from the beginning oftarget, regardless of the startpoint. If startpoint is not specified, specified as 0, 1, or as a negative number, target is searchedfrom the beginning. CHARINDEX returns 0 if seekstring is not found.6.1.12 COALESCECOALESCE(expression1,expression2,...)Returns the first non-null expression from the specified list of expressions.6.1.13 COL_NAMECOL_NAME(object_id,column_id)Returns the name of the column. Can be used in procedure code or trigger code.T<strong>SQL</strong> supports the two-argument form of this function. It does not support a third argument.6.1.14 CONVERTCONVERT(datatype,expression[,format-code])Returns the expression converted to the specified datatype.When datatype is BIT and expression is a boolean value: if the input value is a non-zero number, the result is 1. if the inputvalue is 0, the result is 0. If the input value is the string 'TRUE' (case insensitive), the result is 1. If the input value is thestring 'FALSE' (case insensitive), the result is 0. If the input value is NULL, the result is NULL. Any other input valuegenerates an <strong>SQL</strong>CODE -141 error.When datatype is datetime or timestamp and expression is a date value string, such as '2004–11–23', a time value of '00:00:00'is supplied. When expression is a time value string, such as '1:35PM' and datatype is datetime or timestamp, the time isconverted to a 24-hour clock, the AM or PM suffix is removed, a missing seconds interval is filled in with zeros, and thedefault date value of '1900–01–01' is supplied. Thus '1:35PM' is converted to '1900–01–01 13:35:00'.CONVERT supports the DATETIME2 data type. <strong>Caché</strong> maps DATETIME2 to system-defined DDL mapping%Library.TimeStamp. This mapping is supplied with new installs; if you are using an upgrade install, you may need tocreate this mapping.The optional format-code argument is used to specify a date/time format when converting a datetime or timestamp valueto a string. By specifying various format codes you can return a dates and times in a variety of different formats. The<strong>Caché</strong> <strong>Transact</strong>-<strong>SQL</strong> (T<strong>SQL</strong>) <strong>Migration</strong> <strong>Guide</strong> 37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!