User bio
404 bio not found
Member since Feb 4, 2016
Replies:

the language=tsql feature allows you to write SQL statements that are supported by transact SQL.

https://docs.intersystems.com/iris20252/csp/docbook/Doc.View.cls?KEY=GTS...

InterSystems TSQL is an implementation of the Transact-SQL procedural language which supports many of the features of both the Sybase and Microsoft implementations. Transact-SQL is used with Sybase Adaptive Server, Microsoft SQL Server (MSSQL), and other platforms.

On the one hand it means if you are familiar with tsql then you can continue to write using it's supported syntax and

When you run TSQL code on the InterSystems IRIS platform, the code is compiled into the corresponding InterSystems SQL and ObjectScript code. ObjectScript is InterSystems object-oriented programming language. The compiled code is run on InterSystems IRIS and available for debugging purposes, if needed. This compilation step is fully automated and not a one-time migration task. The migration effort consists of loading the schema, data and TSQL code from the old environment to InterSystems IRIS. From then on you can continue to use and modify the TSQL application code, simply recompiling it after making any changes.

On the other hand if you use language =tsql you may not be able to use the extensions that InterSystems SQL supports such as implicit join syntax.

InterSystems SQL provides a special –> operator as a shorthand for getting values from a related table without the complexity of specifying explicit JOINs in certain common cases. This arrow syntax can be used instead of explicit join syntax, or in combination with explicit join syntax. Arrow syntax performs a left outer join.

While you can write a method or trigger using language=tsql I do not believe you can write a class query with language = tsql.  In this case you are kind of mixing apples and oranages.  

A class Query is a defined/callable query statement that can optionally be defined as a SQLProc.  When a Query is defined it can be defined as %Query in which case you write the Execute/Fetch/Close and within there I imagine you could use language = tsql but this is the less common approach and is a special case.  If Query is based on %SQLQuery you would simply provide an InterSystems SQL statement and not a tsql statement.

A class method can define language =tsql and this means the sql statements in the method are using the tsql dialect.  While a classmethod can also be defined as a SQLProc that can either act as a function returning a value or can use ReturnResultSets to 

Specifies whether this method returns result sets (so that ODBC and JDBC clients can retrieve them).

The Data keyword means to capture/store the values of City and State in the index but not as a key.  if your sql query needs to query for the ZipCode, City, and State with Data=(City,State) the query can be index satisfiable, meaning it will read data from the index and get the City and State from the index vs. having to go to the master map/Table to get the City and State.

Certifications & Credly badges:
Global Masters badges:
Followers:
Following:
Stephen has not followed anybody yet.