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.

T<strong>SQL</strong> Variables7.2.9 @@<strong>SQL</strong>STATUSContains an integer specifying the completion status of the most recent <strong>SQL</strong> statement. Available values are: 0=successfulcompletion; 1=failure; 2=no (more) data available.SET myquery = "SELECT @@<strong>SQL</strong>STATUS AS <strong>SQL</strong>Status"SET tStatement = ##class(%<strong>SQL</strong>.Statement).%New(,,"MS<strong>SQL</strong>")SET qStatus = tStatement.%Prepare(myquery)IF qStatus'=1 { WRITE "%Prepare failed",$System.Status.DisplayError(qStatus) QUIT}SET rset = tStatement.%Execute()DO rset.%Display()COS $Case($Get(<strong>SQL</strong>CODE,0),0:0,100:2,:1)<strong>SQL</strong> CASE :<strong>SQL</strong>CODE WHEN 0 THEN 0 WHEN 100 THEN 2 ELSE 1 END7.2.10 @@TRANCOUNTContains the number of currently active transactions.SET myquery = "SELECT @@TRANCOUNT AS Active<strong>Transact</strong>ions"SET tStatement = ##class(%<strong>SQL</strong>.Statement).%New(,,"MS<strong>SQL</strong>")SET qStatus = tStatement.%Prepare(myquery)IF qStatus'=1 { WRITE "%Prepare failed",$System.Status.DisplayError(qStatus) QUIT}SET rset = tStatement.%Execute()DO rset.%Display()COS $TLEVEL<strong>SQL</strong> $T<strong>SQL</strong>_TRANCOUNT()7.2.11 @@VERSIONContains the <strong>Caché</strong> version number and date and time of its installation.SET myquery = "SELECT @@VERSION AS CacheVersion"SET tStatement = ##class(%<strong>SQL</strong>.Statement).%New(,,"MS<strong>SQL</strong>")SET qStatus = tStatement.%Prepare(myquery)IF qStatus'=1 { WRITE "%Prepare failed",$System.Status.DisplayError(qStatus) QUIT}SET rset = tStatement.%Execute()DO rset.%Display()COS $ZVERSION56 <strong>Caché</strong> <strong>Transact</strong>-<strong>SQL</strong> (T<strong>SQL</strong>) <strong>Migration</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!