9 Followers · 1.1K Posts

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

Article Dmitry Maslennikov · Sep 15, 2022 4m read

On the Latest GlobalSummit 2022, InterSystems Introduced Cloud SQL. So, you may have lightweight InterSystems IRIS with access to SQL only. Well, what if you would still need some Interoperability features in the cloud as well? There are various solutions on the market nowadays, which offer a bunch of integration adapters out of the box and can be extended with support from the community. Some time ago, I've implemented an adapter for the Node-RED project, which can be deployed manually everywhere you want. Now I would like to introduce a new integration with my recent discovery, n8n.io

Banner image

n8n.io is a workflow automation platform, that supports over 200 different integrations out of the box and from a community, and now including InterSystems IRIS.

3
0 718
Question Manu Jose · Sep 6, 2022

How can we insert into a table using a stored procedure

Table structure :

CREATE TABLE SampleHospital (
    Hospital VARCHAR(50),
    Location VARCHAR(50),
    UserName VARCHAR(50),
       UserFullName VARCHAR(70),
       LastLogin TIMESTAMP,
       LoginCount int)

Procedure Name:

call Custom_MENS_Other.samplesp('2021-11-02','2021-11-04','H001')

2
0 304
Question Adrian Izadpanah · Aug 22, 2022

Hi, 

I am trying to input an entire xml into a sql server table. I am doing this via an operation in Ensemble.

I keep getting the following error

[SQL Server]XML parsing: line 0, character 0, unrecognized input signature

I have setup the table with a column parameter XML.

Here is the request object that is being sent to the store procedure

<reqSQL xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema">

<SQLScript>

{ call dbo.PopulateDataTable(?,?,?,?,?,?,?)}

</SQLScript><lstInputParams><lstInputParamsItem>

test

</lstInputParamsItem><lstIn




0
0 525
Question Augie Turano · Oct 9, 2020

In MS SQL Server i can do this:

SELECT 
Category, CrewNumber, MedicalCertificationDate, Seat, SeatbeltUsed, Sex, ShoulderHarnessUsed, ToxicologyTestPerformed, childsub
INTO #tempfemale
FROM Aviation.Crew
WHERE Sex = 'F'

The code would create  a new temporary table with the fields defined from Aviation.Crew.   I cannot find how to do this in Cache SQL in the documentation.  Can someone show me the correct syntax or other solution?  This is a very simple example but i have very large tables with a lot of fields  that require numerous filters and where clauses,  having this type of mechanism would

11
1 2700
Article Yuri Marx · Aug 8, 2022 24m read

In this article you will have access to the curated base of articles from the InterSystems Developer Community of the most relevant topics to learning InterSystems IRIS. Find top published articles ranked by Machine Learning, Embedded Python, JSON, API and REST Applications, Manage and Configure InterSystems Environments, Docker and Cloud, VSCode, SQL, Analytics/BI, Globals, Security, DevOps, Interoperability, Native API. Learn and Enjoy!

Machine Learning

Machine Learning is a mandatory technology to build advanced data analysis and automate manual activities with excellent efficiency. It

6
7 1159
Question Michael Lundberg · Aug 15, 2022

Hi!

I have a question regarding SQL insert/update from the mananger portal's SQL window.

I am trying to do an insert with a value that contains multiple spaces ($32) between two words. This is needed for a comparative reason. But the spaces are automatically trimmed away all the time. How should I write to keep these?

Example:

Insert into TableA
(MyColumn) Values('xxxx    yyyy')

then the spaces are trimmed away and it becomes: 'xxxx yyyy'

But I want to keep the spaces. How do I get around the problem?

Regards,
Michael

4
0 307
Question Arthur K · Jun 5, 2022

Hi ,

     When I use jdbc driver to query the column info ,the "REMARKS" field always show the same as the "COLUMN_NAME" field.

When I use the sql "select * from INFORMATION_SCHEMA.columns a where a.table_name='some table name ' " to query columns info,there has a "DESCRIPTION" field ,the value is some comment for the current field.

So is there anyway to return the description to the jdbc  remarks field? And is there anyway to update the desciption or remarks field? Or is there some other way that I don't know to manage column comment info?

1
0 479
Question Glenn Bickel · Aug 11, 2022

Hi,

I encountered a strange issue I just can’t solve and I am running out of ideas. After reading the relevant passages of the documentation, asking the community is my last resort.

The task itself is not complicated at all. I am using an EnsLib.SQL.OutboundAdapter to connect to a MS SQL Server (12.0.6433.1) and execute a simple query. Said query is using a temporary table from which I just can’t select any data afterwards. All I get is this error message: <Ens>ErrNoSQLColumns.

I reduced the statement for debugging to this query:

DECLARE @result AS TABLE(

                CaseID varcha

3
0 381
Question Nicola Sartore · Nov 5, 2021

I running a query and get the results inside a result set. Now I have to iterate through the result set many times. From the doc I've seen only the Next() method. Is there a way to reset the cursor? Otherwise what is a good data structure to save multiple rows of a table?

My code in this case is something like this:

   set sql = "SELECT * FROM MY_TABLE WHERE X= '"_Y_"'"
   set status = ..Adapter.ExecuteQuery(.rs, sql)
    // somehow iterate the rs more than one time

6
1 1860
Question Jun Suzuki · Aug 8, 2022

Hello, new user here ! My admin granted me all access to the domain I'm working on. Nonetheless, I'm unable to perform simple SQL queries such as creating a table or an index.

What I have tried :

  • Creating a table : within the namespace I've been granted access to, I'm trying to create a table with 2 methods :

    • Basic query : CREATE TABLE test.hello_world (col1 INTEGER, col2 VARCHAR) This raises the error :

    [SQLCODE: <-400>:<Fatal error occurred>] [%msg: <Exception caught during dSQL statement %Execute: <PROTECT> ^rINDEXCLASS("HS.JSON.WRITER"),/iris/irishealth/mgr/HSCUSTOM/>]

    • Creating a t
1
0 506
Question Dom GMMH NHS Trust · Mar 17, 2022

Hi, we are trying to run a dynamically generated Oracle Insert SQL script using Do $SYSTEM.SQL.DDLImport("Oracle",""," sql.txt",[Error Log]) to insert multiple rows into a Linked Table within HealthConnect to an Oracle database.


We have tried using statements that are accepted within Oracle but not when using Intersystems DLL along the lines of :

INSERT  INTO mytable (column1, column2, column_n)
  SELECT expr1, expr2, expr_n FROM Dual  UNION ALL
   SELECT expr1, expr2, expr_n FROM Dual;
  
SELECT mytable (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
  INTO mytable (column1, column2,

4
0 877
Article Timothy Leavitt · Jun 28, 2022 2m read

An interesting pattern around unique indices came up recently (in internal discussion re: isc.rest) and I'd like to highlight it for the community.

As a motivating use case: suppose you have a class representing a tree, where each node also has a name, and we want nodes to be unique by name and parent node. We want each root node to have a unique name too. A natural implementation would be:

Class DC.Demo.Node Extends%Persistent
{

Property Parent As DC.Demo.Node;Property Name As%String [ Required ];
Index ParentAndName On (Parent, Name) [ Unique ];
Storage Default
{
<Data name="No
8
0 1255
Question Timothy Leavitt · Jul 20, 2022

I'm getting wrapped around the axle with CAST and CONVERT and can't seem to find a way to do this (short of adding a stored procedure wrapping $zdt($zdth(posix,-2),3), which I'm refusing to do on principle, because there has to be some way to make this work).

Any ideas?

4
0 349
Question Thembelani Mlalazi · Jul 19, 2022

I am calling a stored procedure over an ODBC connection and every time I call it there are several warnings written to the log event {Found no Parameter 1 (used as 1) for query}.I seem to be getting this on every query executed and that seems to happen a number of times the query parameters are per query and its filling up my disc.

1) Is there a way to suppress these warnings as the query seems to be executed and data written to the database?

2) Is there a way to pass Null values to the procedure and not generate these warnings as I suspect there are caused by the Null values expected to pop

1
0 330
Question Jack Boulton · Jul 18, 2022

Hi,

I'm trying to load some data into IRIS using LOAD DATA in the IRIS terminal however I am getting blocked by this error. I have read the documentation on this page trying to set up a gateway connection but get the same Connection cannot be established error.

This is what is in the %Java Server activity log

ID 	Date Time 	Record Type 	Job 	Text 
8132022-07-1810:37:09	Info	28048Job command successful, started monitor process '6404'
8112022-07-1810:37:09	Info	28048	Starting background process to monitor the Gateway Server
8102022-07-1810:37:09	Info	28048	Gateway Server start-up



2
0 874
Article Pravin Barton · May 12, 2022 1m read

Say I have a persistent class in IRIS with an optional property EmailOptIn:

Class Person Extends %Persistent
{
Property Name As %String;
Property EmailOptIn As %Boolean;
}

I later realize that I'm doing a lot of null-checking on this property where I shouldn't need to. The solution is to make this a required property:

Class Person Extends %Persistent
{
Property Name As %String;
Property EmailOptIn As %Boolean [ Required ];
}

When I make this change I'll need to update all the existing data to set a reasonable default where it is null. Otherwise I'm in a bad state where updating the Name of a

7
0 588
Question Richard Housham · Jul 16, 2018

Hi I've got a service setup to query a sql server via ODBC.

I've got all the parameters etc setup and everything is ok

My Query is

SELECT TOP 1
CI.ClientID, 
Gender, 
DateOfBirth, 
MaritalStatus AS MartialStatusCode,
(SELECT CodeDescription FROM GenMaritalStatus WHERE Code =  MaritalStatus) AS Martial,
Ethnicity AS EnthnicityCode,
(SELECT CodeDescription FROM GenEthnicity WHERE Code = Ethnicity) AS Ethnicity,
Nationality AS NationalityCode,
(SELECT CodeDescription FROM GenNationality WHERE Code = Nationality) AS Nationality,
DateOfDeath,
CN.Surname AS Surname,
 ISNULL (CN.GivenName1, '')
 + ISNULL( CN.G

11
1 2055
Question Andy Stobirski · Jun 30, 2022

I have a table with a Varchar(max) column that I have created via the HealthShare SQL portal, and I see that in it's underlying class that column corresponds to a %Stream.GlobalCharacter

When I try to do a text search on that column (referenced as cd.Code in the example below) I get an error

select * 
from DevTools_CodeAnalysis_tables.Code cd
inner join DevTools_CodeAnalysis_tables.MethodData mtd
on charindex( mtd.qualifiedRef,  cd.Code) > 0

It produces the error

 Scalar function CHARINDEX (arg2) not supported for stream fields

How do I search it?
 

1
0 392
Question Lewis Houlden · Jun 20, 2022

Hi all

I'm struggling to insert into a table, and it is baffling me. The insert statement is now very simple (I was using a complex INSERT SELECT statement but I'm trying to narrow down the problem).

Insert statement:

INSERT INTO Phu_Replay_Schema.ReplayMessageModel (Completed, MessageHeaderId, NewHeaderId, NewTargetName) VALUES (true, 3616, null, 'Router_ReplayHL7')

I get a SQLCODE -12 error, and I can't understand why: A term expected, beginning with one of the following: identifier, constant, aggregate, $$, :, (, +, -, %ALPHAUP, %EXACT, %MVR, %SQLSTRING, %SQLUPPER, %STRING, %TRUNCATE, o

5
0 1244
Article Eduard Lebedyuk · Dec 2, 2020 2m read

In the good old days (tm) determining the size of the data, streams, and indices for a class/table was easy - you just ran %GSIZE and check D, S, and I globals respectively.

However, nowadays sharding, optimized global names, and indices in separate globals produce %GSIZE output looking like this:

            Global Size Display of /irissys/data/IRIS/mgr/irisshard/
                              1:35 PM  Dec 02 2020

          IRIS.Msg       1     IRIS.MsgNames       1     IRIS.SM.Shard       1
       IS.DGoWeK.1   24359       IS.DGoWeK.2       3       IS.DGoWeK.3    2810
       IS.DGoWe

6
5 1462
Article Robert Cemper · Jan 2, 2022 3m read

Thanks to @Yuri Marx we have seen a very nice example for DB migration from Postgres to IRIS.
My personal problem is the use of DBeaver as a migration tool.
Especially as one of the strengths of IRIS ( and also Caché) before is the availability of the
SQLgateways that allow access to any external Db as long as for them an access usinig 
JDBC or ODBC is available. So I extended the package to demonstrate this.

3
2 901
Question Scott Roth · Jun 1, 2022

I would like to capture any NACK's that is sent back to the Operation. The Operation is already setup to "Save Replies/IndexNotOK's", but I would like to see if we can query Cache and pull those NACK's into an extract.

Is this possible?

Thanks

Scott

4
0 367
Question Andy Stobirski · May 28, 2022

Hi Guys,

So I've been following this guide in using a %Library.ResultSet with a  ClassName / QueryName as described in the first example.

https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic…

The code I've got so far doesn't work and is as follows:

set rs=##class(%ResultSet).%New()
set rs.ClassName="GMECC.DocmanConnect.Tables.vwNewGPs"set rs.QueryName="GetRows"set sc=rs.Execute("a")  If$$$ISERR(sc) Do DisplayError^%apiOBJ(sc) Quitwhile rs.%Next() { do rs.%Print() }		

And the referenced class is

Class GMECC.Docma
5
0 483