9 Followers · 1.1K Posts

SQL is a standard language for storing, manipulating and retrieving data in relational databases.

Question Mark Sharman · Sep 19, 2019

Hi,

I've a Service utilising the Adapter EnsLib.SQL.InboundAdapter, which uses a Credentials item set with the details of a local SQL account. This currently works, however, we're looking to use the credentials of an AD domain account.

The domain account is a member of an AD security group, which has the required permissions on the source SQL database. I've checked that access is possible with this account via SQL studio.

I've tested setting the Credential username as domain\username and username@FQDN, but neither create a successful connection.

2
0 372
Question Yuri Marx · Dec 6, 2020

In Oracle database, the synonym is an alternative name for objects such as tables, views, sequences, stored procedures, and other database objects.

You generally use synonyms when you are granting access to an object from another schema and you don't want the users to have to worry about knowing which schema owns the object.

Is IRIS SQL sintax has something like this: (oracle sintax)

CREATE PUBLIC SYNONYM suppliers
FOR app.suppliers;
1
0 252
Question Florian Hansmann · Dec 4, 2020

Hey Intersystems Community-Member,

Following Issue: When I update a SQL table like (update OnlineV3Admin.ParameterApp set popuptext = '' where ID = '1') and then read it for my Json WebService there is a /"x00" in my Json.

What is the best option to disable that? I need here  a empty String and not /x00.

Any ideas?

Best regards,

Florian Hansmann

1
0 338
Announcement Neerav Verma · Feb 21, 2019

1. Define Persistent ClassCall utility class to fetch json via query.Class Test.JSONFromSQL Extends (%Persistent, %Populate){Property FirstName As %String(POPSPEC = "FirstName()");Property LastName As %String(POPSPEC = "LastName()");Property CountOfThings As %Integer(POPSPEC = "Integer()");ClassMethod OutputJSON() As %Status{If '..%ExistsId(1) Do ..Populate(100)Set sql="select FirstName, LastName, CountOfThings from Atmus_Web_Test.JSONFromSQL"Quit ##class(JSON.FromSQL).OutputJsonFromSQL(sql)}2. Utility ClassClass JSON.FromSQL Extends JSON.Base{ClassMethod OutputJsonFromSQL(sql,%parm...) As 

1
0 411
Question Ramesh Ramachandran · Sep 23, 2020

We use ExecureProcedure() to execute a stored procedure which returns a result set. But we see lot of "Invalid cursor state" errors when the result set is empty.  The connection to SQL server database is made through ODBC. 

ERROR #6022: Gateway failed: Fetch. + ERROR <Ens>ErrGeneral: SQLState: (24000) NativeError: [0] Message: [Microsoft][ODBC Driver 11 for SQL Server]Invalid cursor state 

Here is the code snippet from the business operation class which uses EnsLib.SQL.OutboundAdapter  

do ..Adapter.DSNSet(DataSourceName)

2
0 9885
Discussion Benjamin De Boe · Nov 9, 2020

Hi,

InterSystems IRIS has long supported the obvious translation functions required to for converting to upper or lowercase to enforce case-insensitive string comparison (e.g. in ObjectScript with $zconvert) and sorting (e.g. with SQL collation functions, not to be confused with NLS collation). Customers in international contexts have at times used custom workarounds to also treat accent insensitivity or even more advanced normalization duct tape. We’re looking to address such use cases at the system and SQL level to increase convenience for this international audience, which is well represented on the Developer Community.

5
0 399
Question Daniel Aguilar · Nov 4, 2020

Good Morning,

I have this question for a long time. When I make an insert by SQL from an external application in the fields of type %String, if they are empty, it writes the character $c(0) in the global.

Is there a way so that if an Insert is received in a field of type% String with null value instead of the $ c (0) it leaves it empty?:

I have the class defined like this:

Class User.MiClase Extends (% Persistent,% XML.Adaptor)

and the property like this:

Property myProperty As% String;

I have tried creating a trigger or setting default values but it doesn't work.

7
0 1252
Article Eduard Lebedyuk · Feb 5, 2016 11m read

Class Queries in InterSystems IRIS (and Cache, Ensemble, HealthShare) is a useful tool that separates SQL queries from Object Script code. Basically, it works like this: suppose that you want to use the same SQL query with different arguments in several different places.In this case you can avoid code duplication by declaring the query body as a class query and then calling this query by name. This approach is also convenient for custom queries, in which the task of obtaining the next row is defined by a developer. Sounds interesting? Then read on!

17
7 7675
Question Phuc Nguyen · Oct 27, 2020

Hello,

I have a csp that occasionally will show Timeout error.

 


I am looking at the SQL Statements tab of the SQL Explorer:

The Average time is around 1.4, what would cause the CSP page to timeout if the query average time is 1.4 while the CSPGateway Server Response Timeout and Queued Request Timeout are default to 60 seconds? Does sql query from CSP that causes web pages to timeout get logged into SQL Statements ?

Thanks

9
0 437
Question Daniel Buxton · Oct 20, 2020

Hey, 

I have a value in epoch time in which I need convert in order to be able to lookup a table that has dates in YYYY-MM-DD HH:MM:SS format

I thought the below would work but it is not.

select COUNT ('Arrival Time') FROM dbo.table where 'Arrival Time' < DATEADD(ms, CONVERT(int,LEFT(1603173432000, 20)), '1970-01-01 00:00:00')

8
0 450
Article Anton Umnikov · Apr 7, 2016 1m read

Presenter: Anton Umnikov
Task: Identify your slowest SQL queries and tune them for better performance
Approach: Use InterSystems’ query profiling and analysis tools. Discuss how system configuration can affect performance
 

This session will show you how you identify the weakest link in your application SQL and introduce you to the fine art of tuning those queries. To do this we will take a look at InterSystems query profiling and analysis tools, as well as how system configuration can impact SQL performance.

Problem: Obscurity on how our SQL engine works

Content related to this session, including slides, video and additional learning content can be found here.

2
0 442
Question Scott Roth · Oct 9, 2020

I noticed when creating Record Map's within Ensemble that it is creating a Persistent cache table as it translates the file and puts it into the Record Map data structure.

I was wondering if there was a way to add a column to the cache table that is Hidden from the record map, but is a calculated date value on when that record was inserted? 

From time to time I have gotten questions about what was valued in the incoming data stream, and I thought it would be helpful to add a date so I can sort on by which date that record came in on.

Thanks

Scott

4
0 330
Question Ewan Whyte · Jul 8, 2020

Hi,

I'm trying to ultimately create a function that I can use with HL7 messages that calls a stored procedure held on a SQL Server.

Initially I triedextending the function class to use the sql inbound adapter and/or EnsLib.SQL.Common, but this wouldn't work from the class method for the function.

Then I attempted to use the linked stored procedure using the wizard where it connected fine and I could find the sp but but it wouldn't return any data when ran. The test sp should just return an int.

The class document produced is this.

5
0 1244
Question Rodrigo Mori · Sep 17, 2020

I am trying to create a Procedure in Caché, but this message is showing:

<UNDEFINED>frmit+118^%qaqpsq *mt("v",1)

This is the procedure:

CREATE PROCEDURE testebi.sp_cargainicial()
BEGIN
    INSERT INTO testebi.Fato_Atendimentos (
    PK_OsProcedimento )
    SELECT ID
     from dado.TblOsProcedimento    ;    

    UPDATE testebi.Fato_Atendimentos as A SET PrimeiraOS = 1
    FROM 
    (select min(convert(int,data)) data, paciente 
    from dado.arqordemservico
    group by paciente) as b
    WHERE a.fk_paciente = b.paciente and  a.fk_Data  = b.data;
end

2
0 360
Question David Foard · Sep 16, 2020

I have a class that has 2 different cursors for different queries, audit1 and audit2. which are in 2 different methods. The first query runs fine, but the second one generates a 102 error.

Is there an issue with having more than 1 cursor in a class?

Has anyone seen this before?

2
0 281
Question VICTOR GALVAO · Sep 15, 2020

Hi guys!!

In the system that I work, I came across an iterator pattern that uses the %Resultset library without performing the close after executing the query. Does anyone know how to say what are the impacts of not performing such a procedure?

If you have any model of iterator pattern made in caché to recommend as a good example, I will be grateful hehe  :D

5
0 404
Question Joao Palma · Aug 21, 2020

Hi everyone

Anyone knows how can we add a column to an existing linked table in Cache to reflect the external SQL table?

I've tried different queries. It does not fail but does not add the column either...

4
0 601
Article Zhong Li · Aug 22, 2020 24m read

Keywords:  IRIS, IntegratedML, Machine Learning, Covid-19, Kaggle 

Purpose

Recently I noticed a Kaggle dataset  for the prediction of whether a Covid-19 patient will be admitted to ICU.  It is a spreadsheet of 1925 encounter records of 231 columns of vital signs and observations, with the last column of "ICU" being 1 for Yes or 0 for No. The task is to predict whether a patient will be admitted to ICU based on known data.

1
1 977
Question Ba Moser · Aug 25, 2020

I use these example classes:
Class Sample.Address Extends (%SerialObject, %Populate)
{Property Street As %String;
Property City As %String;
Property State As %String(POPSPEC = "USState()");
Property Zip As %String;}
Class Sample.Person1 Extends (%Persistent%Populate)
{  Property Name As %String;
Property Home As Sample.Address;
Property AR As array Of Sample.Address; }

In SQL it is Table Sample.Person1

No problem to define INDEX on Home_State

But Table Sample.Person1_AR

HowTo define an INDEX on AR_State ?
Index st On AR.State;

Does not compile!

12
0 750
Question Ba Moser · Aug 23, 2020

I try to compare classic JOIN against implicit JOIN.

It is a simple case. But I am surprised.

The class:
Class Sample.Person1 Extends (%Persistent, %Populate)
{  Property Name As %String;
Property Home As Sample.Address;
Property AR As array Of Sample.Address; }

Query #1 - classic:
select name,home_state,a.* from sample.person1 p
join sample.person1_AR a on p.Id=a.person1
and home_state=AR_state

Query #2 - implicit
select person1->name,person1->home_state,*
from sample.person1_AR where person1->home_state=AR_state

for both I have the same query plan:

2
0 270