I need iterate multiple times the same ResultSet. How can I do a rewind on it?
SQL is a standard language for storing, manipulating and retrieving data in relational databases.
SQL is a standard language for storing, manipulating and retrieving data in relational databases.
I need iterate multiple times the same ResultSet. How can I do a rewind on it?
One of my colleagues had developed an interface in Health Connect (HealthShare 2019.1) to add large amounts of data to an external SQL Server database. The data comes from many text files with delimited rows and data for one table per file. There is a business process to read a file line by line and send an Insert Request to an operation. The request contains an Insert statement like ‘Insert into TABLE columns (col1, col2, … colZ) values (val1, val2, … valZ).’ The Health Connect operation utilizes Outbound SQL Adapter to insert one row into a table per request.
Hello Community,
I am trying to insert multiple values in a table. Below is the simple sql statement.
Insert Into TableX
values ('Name', 'Address', 'Phone')
How can i do multiple inserts(rows) in one single statement?
Values are not in another table, so i cannot use Select into.
Thanks,
Jimmy Christian.
Hi there,
Does anyone have an example of the method used to run an SQL query and generate the view in a Mumps routine. I have several SQL queries created from a vendor that need to be converted and the corresponding view referenced. I cannot seem to find any examples in IDX routines or in the IRIS/Cache documentation. Any help is appreciated.
-Alicia
The 2021.2 release of the InterSystems IRIS Data Platform includes many exciting new features for fast, flexible and secure development of your mission-critical applications. Embedded Python definitely takes the limelight (and for good reason!), but in SQL we've also made a massive step forward towards a more adaptive engine that gathers detailed statistical information about your table data and exploits it to deliver the best query plans. In this brief series of articles, we'll take a closer at three elements that are new in 2021.2 and work together towards this goal, starting with Run Time Plan Choice.
It's hard to figure out the right order to talk about these (you can't imagine how often I've reshuffled them in writing this article!) because they fit together in such a nice way. As such, feel free to go on a limb and read these in random order
.
This is the third article in our short series around innovations in IRIS SQL that deliver a more adaptive, high-performance experience for analysts and applications querying relational data on IRIS. It may be the last article in this series for 2021.2, but we have several more enhancements lined up in this area. In this article, we'll dig a little deeper into additional table statistics we're starting to gather in this release: Histograms
Hi members,
I have these data :
and need to exploit the first character of cot field (Library CDU classification) like this :
I get this result... it's approximatively what I want... but I need it in just one line !
With mySQL I get it with just GROUP BY rcddate
In Cache SQL I have to add {fn LEFT(cot,1)} to get the counts of each first character of cot... and seems {fn WEEK(rcddate)} doesn't make the job !
There is a trick ? or I make something wrong ?
kind regards.
I've been accessing Cache tables from a developer/reporting side, but am now involved in a project to create a data warehouse for our application. I'm trying to find a query I can use to return the sizes of all the tables in the database, so we can identify the largest tables and handle those individually. Can someone give me a query I can run against our Cache database to return the sizes of all the tables from largest to smallest?
Thanks for the help
When i use &sql(SELECT ......) in Cache I can watch the generated code
In the generated .int code and see what is happening.
Just with my normal rights
Now in IRIS I have just 4 line calling some class %sqlcq.***
With enough rights i find there is no such class but the generated .int routine
That holds the code that i had in my .int on Cache
Can i switch this back somehow ?
Hi Dev Community,
I have a persistent Document class that has a FileName string property and another Question class that has an optional one-to-many relationship with Document.
I'm trying to add a SqlComputed property to the Question class (docFileName) where docFileName = Document.FileName if there is a related Document or an empty string if there isn't one.
I'd prefer the property to be SqlComputed so that if Question.Document changes, Question.docFileName will automatically update.
Does anyone know the syntax for accessing the properties of a related object in the SqlComputeCode?
Thanks!
Hi,
Is there way to set up an automated batch job in the Management Portal to execute an SQL query. Also, how can the related view be exported. I have executed the SQL queries and see the view and created files manually. I could not find any related documentation on the batch processes, but I thought batch or automated jobs could be set up via the Management Portal. Any information is appreciated...
Thanks
Hey Developers,
Please welcome the first session from the InterSystems Virtual Summit 2021:
I want to switch between different DSNs in business operations to query different servers, but the DO ..Adapter.DSNSet("DSNName") code will report a 15-second connection timeout error when switching DSNs. What should I do?
A permanent job opportunity has arisen for a Caché/Ensemble /Iris developer with at least 2 years experience. My client is a specialist resource provisioner of developers for high profile clients in the finance, healthcare, retail, distribution and credit business that are mainly based in central London. My client is looking for a highly-motivated individual who thrives in an environment where problems are open-ended.
Hi Guys
I'm rather new to HealthConnect, and I've been doing a lot of work with the browser based SQL portal and don't particularly like it. Is there an alternative application that I can use, something like SQL Express or VScode with a plugin?
Andy
One of our apps uses a class query to support a ZEN Report and works just fine in that report, producing the expected results every time. We’ve since migrated to InterSystems Reports and noticed that, for a report using the same class query, 100s of extra rows with the same column values appear at its bottom.
We eliminated InterSystems Reports as the source of the problem by recreating the same “extra rows” issue with an Excel spreadsheet calling the same class query as a stored procedure.
What was the issue?
I want to INSERT a record in a database using JDBC in OBJECTSCRIPT. At the same time, I want to obtain the insert ID. Is there a way to achieve this using the SQL Outbound adapter?
My code is something like this now:
Property Adapter As EnsLib.SQL.OutboundAdapter;
set sql = " INSERT INTO Prenotazioni_CUP "_
" (ID, cf
" VALUES (SEQTAB.NextVal, ?) "
set status = ..Adapter.ExecuteUpdate(.rs, sql, pRequest.cfAssistito)
Hi guys,
My client has a requirement to add a column of random numbers to the query result.
I wrote a function as below:
Class Utils.SqlUtility Extends %RegisteredObject
{
ClassMethod GetSomeNumber(intInput As %Integer) As %Integer [ SqlName = GetNumber, SqlProc ]
{
Return $R(intInput)
}
}
But in the returned sql result, every row share the same value, as below,
SELECT Utils.GetNumber('456'),
ID, Citizenship, DOB, FirstName, Gender, IDNumber, LastName, PatientNumber, PhoneNumber
FROM CDR.Patient
.png)
How may I refactor the function or sql to make the random value really random on each of the rows?
Thanks.
I need to execute multiple DELETE statements in a single query like this
DELETE FROM TableName WHERE ID = 2;
DELETE FROM TableName WHERE ID = 3;
DELETE FROM TableName WHERE ID = 4;However It does not work when there're more than 2 statements and gives me an error
Expected FROM found WHERE^DELETE FROM TableName WHERE
Using IN is not an option.
Good morning -
As we're starting to create more custom message classes to represent out JSON-based integrations, I was pondering how to implicitly grant SELECT privileges to a specific Security Role so they can utilize Message Viewer to search through the message history.
So if all of our custom JSON message classes are under OurParentPkg.Messages.REST.* (e.g., OurParentPkg.Messages.REST.AddPatientRequest and OurParentPkg.Messages.REST.AddPatientResponse), is there a method to ensure that our analysts can be granted the SELECT permission to anything created under OurParentPkg.Messages.
Hello, I wonder if we can run SQL queries to find data in Lookup tables?
I have written below method inbound adapter myAdapter Extends Ens.InboundAdapter [ ProcedureBlock ] returns -400
If i have written in any other
{
set msgCount=-1
&sql(SELECT count(ID) INTO :msgCount FROM Ens.MessageHeader)
If SQLCODE=0 Quit msgCount
Quit SQLCODE
}
Could you please some one tell me where should write this class method? What I am doing wrong?
Thanks
PRASHANTH
Benjamin De Boe wrote this great article about Universal Cached Queries, but what the heck is a Universal Cached Query (UCQ) and why should I care about it if I am writing good old embedded SQL? In Caché and Ensemble, Cached Queries would be generated to resolve xDBC and Dynamic SQL. Now in InterSystems IRIS embedded SQL has been updated to use Cached Queries, hence the Universal added to the name. Now any SQL executed on IRIS will be done so from a UCQ class.
Why did InterSystems do this? Good Question! The big win here is flexibility in a live environment.
I have extended my operation class from Ens.BusinessOperation class . I want to execute below sql on cache.
&sql(Select demoVersion into :DemoVersion from demointerface.DemoInstances where ID=:demoID)
this line not even giving error.
Please suggest me how to make sure my sql query should work everytime , when i call the class method
Same code is working fine in production but not working in local:(
Thanks a lot
Prashanth Ponugoti
I have an ObjectScript class with a Log property of type %Stream.GlobalCharacter. I need to search the end of each of the logs - is there a way to extract the last 10 lines of the Log stream for each object via SQL? Or is my only option to write an ObjectScript routine to walk the table and inspect each Log property one by one?
Thanks!
Hi Community,
We're pleased to invite you to the upcoming webinar in Spanish called "IntegratedML - Creating ML models in minutes"!
Date & Time: September 30, 4:00 PM (CEST)
Speaker: @Eduardo Anglada, Sales Engineer, InterSystems Iberia
https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic…
method Export(savertn As %Boolean = 0) [ Language = objectscript ]
I am looking to export table to a text file in a programmatic way. I am not familiar with this class and how to invoke a "savertn" as input here.
Essentially I would like to Export Table (SELECT * FROM Table) and save it as a text file locally on Linux server. Is there any examples out there of that? Perhaps I need to save the query output to a global and then pass that input to the export?
So I am working with an inherited SQL query that queries 8 different tables. 5 of which have over a million records.
I have 3 different servers.
Server 1, Server 2 and Server 3. They all have the same data/tables/structure across all servers.
Server 3 has an Iris database engine and the other 2 are Cache 2015.1.4.
I have a problem with views and performance across the servers being inconsistent.
Thankfully Server 1 is the current live server that performs "fast enough".
Server 2 is being synced from Server 1 and acts as a report server.
And Server 3 is supposedly a new Live server.
Hello Community,
we want to use a specific index on our sql-class.
The index we want to use is called "iFilter".
Currently we use the following technique of ignoring all other indices because the automatically chosen index is always too slow.
SELECT TOP 100 d0.Hello everyone
I am new to cache. In an interview i was asked how to optimize a sql query.
I just said I will create index on conditions which are present in where clause. But as per interviewer I should check How query plan is getting executed. This will help in optimizing Sql queries.
I want to know what will be the answer for how to optimize SQL query in cache.
Thanks in advance!!