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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Operators• > (greater than), !> (not greater than), >= (greater than or equal to)When performing equality comparisons (= or ) between date values with different data types, all date and time valuesare compared using the TIMESTAMP data type. Thus two dates in different formats can be meaningfully compared. Adate value declared as a STRING data type can be compared to a date value declared as a DATETIME data type.3.4.2 Concatenation Operator<strong>Caché</strong> T<strong>SQL</strong> supports the + (plus sign) as both a concatenation operator and the addition operator. The plus sign functionsas a concatenation operator with strings. You can concatenate several strings together using this operator. If all item arestrings, T<strong>SQL</strong> performs concatenation; however, if one of the items is a number, T<strong>SQL</strong> performs addition, treating nonnumericstrings as 0.'world'+'wide'+'web' concatenates to 'worldwideweb''world'+'33'+'web' concatenates to 'world33web''world'+33+'web' performs addition (0+33+0=33)In a T<strong>SQL</strong> string concatenation operation, NULL is equivalent to an empty string. In a T<strong>SQL</strong> arithmetic operation, NULLis equivalent to 0. Note that because the plus sign (+) is used for both concatenation and addition, the data type declarationof the NULL variable is critical. The following examples all return “bigdeal”:DECLARE @var1 BINARY(1)DECLARE @var2 VARCHAR(10)SELECT @var1=NULL,@var2=NULLPRINT "big"+NULL+"deal"PRINT "big"+@var1+"deal"PRINT "big"+@var2+"deal"The following example returns 0; it treats the + as an arithmetic operator and interprets the argument as 0 + 0 + 0 = 0:DECLARE @var1 INTSELECT @var1=NULLPRINT "big"+@var1+"deal"<strong>Caché</strong> T<strong>SQL</strong> also supports || as a concatenation operator.3.4.3 Comparison Operators3.4.3.1 BETWEEN<strong>Caché</strong> T<strong>SQL</strong> supports the BETWEEN range check operator of the form: BETWEEN num1 AND num2. BETWEEN isinclusive of the specified range limits.3.4.3.2 IS NULL<strong>Caché</strong> T<strong>SQL</strong> supports the IS NULL match operator. A variable is NULL if it has been declared but not assigned a value,or if it has been explicitly specified as NULL. The empty string is not NULL.3.4.3.3 LIKE<strong>Caché</strong> T<strong>SQL</strong> supports the LIKE pattern match operator. LIKE performs not case-sensitive matching of letters. <strong>Caché</strong> T<strong>SQL</strong>also supports NOT LIKE.3.4.4 NOT Logical OperatorThe NOT logical operator inverts the truth value of the statement that follows it. For example, IF NOT EXISTS(...).NOT is not case-sensitive.<strong>Caché</strong> <strong>Transact</strong>-<strong>SQL</strong> (T<strong>SQL</strong>) <strong>Migration</strong> <strong>Guide</strong> 15

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

Saved successfully!

Ooh no, something went wrong!