Question
· Apr 22, 2020
SQL Statement Highlighting

Hey Community,

my Caché Version: 2013.1 and can't update now.

is it possible to highlight SQL Statements like in embedded SQL with all the features from SQL Statements?

Actually I use SQL Statements with a simple string like:

set myquery = "SELECT TOP 5 Name,DOB AS bdate,FavoriteColors FROM Sample.Person"

But when the queries are more complex it will be very cluttered and unstructured.

0 2
0 228
Question
· Aug 21, 2020
IRIS SQL Linked Table

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...

0 4
0 389

I have an SQL text index defined like this

Index TextIndex On (Text) As %iFind.Index.Basic(IGNOREPUNCTUATION = 1, INDEXOPTION = 0, LANGUAGE = "en", LOWER = 1);

If I run a query like this:

SELECT
Text
FROM Post
WHERE %ID %FIND search_index("TextIndex",'ABC')

I get 20 results with posts containing the term ABC.

But each post can contain the term ABC several times.

0 13
0 359

I have created a custom role in IRIS for users to provide limited view-only access for querying tables in the HSANALYTICS namespace. WinSQL has been installed on a Windows server (WinSQL Lite version 14.0.244.784) and an ODBC connection entry has been created in WinSQL for the users to log in and run SQL queries. The custom role provides the roles/resources included in the attached file. The WinSQL System DSN entry defined is:

Health Insight UAT HSANALYTICS 64-bit InterSystems ODBC35

The ODBC35 driver is defined as:

0 7
0 449

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
%sqlcq.IRISAPP.xEZgUjdXCCgQdZQPpRdOye1Ci2ue.1
That holds the code that i had in my .int on Cache

Can i switch this back somehow ?

0 7
0 468
Question
· Apr 25, 2022
Run multiple Update sql queries

Hi everyone, how do you run multiple quires?

I have tried couple of different ways, but not working.

SET sql = 2

Set sql(1) = "UPDATE QUERY"

Set sql(2) = "UPDATE QUERY"

Set sqlStatement=##class(%SQL.Statement).%New()

Set sc1=sqlStatement.%Prepare(.sql)

If $$$ISOK(sc1) {

Set tResult = sqlStatement.%Execute()

}

else{

$$$LOGERROR("Failed")

}

0 4
0 1K

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

0 2
0 495

Trying to identify which records in the %SYS.Audit table are fails.

Eg, as user "WORKER", I run an attempted a grant, the terminal returns:

SQL> GRANT SELECT ON newschema.patients TO COORDINATOR
[S1000][Iris ODBC][State : S1000][Native Code 112]
[libirisodbc35.so]
[SQLCODE: <-112>:<Access violation>]
[Location: <ServerLoop>]
[%msg: <User WORKER does not have required privileges to grant the privilege(s)>]
[ISQL]ERROR: Could not SQLExecute

but the record in the audit table gives

0 2
0 198

I have table

CREATE TABLE nodes (
        name VARCHAR(50) NOT NULL, 
        parent VARCHAR(50), 
        PRIMARY KEY (name), 
        FOREIGN KEY(parent) REFERENCES nodes (name) ON UPDATE cascade
);

I put some data

INSERT INTO nodes (name, parent) VALUES ('n1', NULL);
INSERT INTO nodes (name, parent) VALUES ('n11', 'n1');
INSERT INTO nodes (name, parent) VALUES ('n12', 'n1');
INSERT INTO nodes (name, parent) VALUES ('n13', 'n1');

Let's delete all

DELETE FROM nodes;

Nope, no way.

SQL Error [124] [S1000]: [SQLCODE: <-124>:<FOREIGN KEY constraint failed referential check upon DELETE of row in referenced table>]
[Location: <ServerLoop>]
[%msg: <At least 1 Row exists in table 'SQLUser.nodes' which references key 'NODESPKey2' - Foreign Key Constraint 'NODESFKey3', Field(s) 'parent' failed on referential action of NO ACTION>]

0 7
0 430

I found the thread that discusses object mapping, in particular mapping a common global among more than one namespace. The example that is given is a simple one when it's ^global(sub1, ^global(sub2, etc. However I'm having trouble getting this to compile/work when the global has a fixed subscript amongst variable ones.

I have this global in namespaces LAB and ARK in the following format:

^CB(1,sub1)=....

^CB(1,sub2)=...

^CB(1,sub3)=...

Here is what I have for this. In it's current state it throws tons of errors:

0 4
0 221
Question
· Aug 31, 2023
SELECT command within CSP

The program below works perfectly when I call it directly from the Terminal, however when I call it from within a CSP it does not work (It does not do the SELECT).

In the USER namespace, the program works both in the Terminal and on the CSP , but in another namespace it only works when called directly in the Terminal.

0 4
0 219

Hi Community,

I am attempting to create a new table by executing a SELECT statement that involves joining multiple tables. However, I encountered an error during execution: '( expected, AS found^Combined AS.' I would also like to create a cube based on this SQL table. However, during the cube creation process, I am prompted to specify a source class, and I'm unsure which class to use as it requires an existing class. Could you please help me identify the issue with the table creation, and provide guidance on selecting the appropriate source class for the cube creation?"

0 1
0 81

I have a NewBie Question.

I have been playing around with "Basic CLass Queries."

I have defined a very simple "Basic Class Query." (see below)

However, I cannot find in the I/S documentation how to execute this query.

Any help is appreciated.

0 8
0 2.3K

I have been using the query below and it was working fine but now it's giving a SQL error. There were no changes made that could cause this to stop working. There is no Field 'APPLICATIONID' in the table.

QueueSQL=select distinct (convert(char(5),SkillsetID)+'='+Skillset) from iagentbySkillsetStat where ApplicationID > 10000
QueueMappingSQL=SELECT DISTINCT (convert(char(5),SkillsetID)+'='+Skillset), SkillsetID FROM iagentbySkillsetStat iagentbySkillsetStat WHERE (iagentbySkillsetStat.ApplicationID>10000)

DB- Intersystems Cache

0 6
0 4.1K

I am trying to return the maximum of the value of 2 fields: LastViewed and LastDownloaded AS a local variable -LastAccessed for each row, using a SQL query . These values are stored as $ H format. Is there an existing SQL command that compares two column values ? I could not find one, so I tried using a $Select statement . I got an error that said A term expected beginning with either of: identifier, constant, aggregate, $$,(,:,+....)

Here is the SQL Query I am trying to run:-

0 5
0 709

Hi Everyone,

I am trying to built a SSIS package thru BIDS Visual Studio 2013. My Datasource is a InterSystems Cache Database, I wanted to Import Tables records from the Datasource to MS SQL Server 2014.

As a Sanity check. I only created one Package to import one Table to MSSQL Server to try out. The connection to the InterSystems Cache Database was successful. The DSN for the InterSystems Cache Database is created in the System for 32 and 64 Bit.

0 6
0 1.9K
Question
· Oct 11, 2018
Double Quotes

Hi,

I am trying to have the output of a field in sql have double quotes around them. The script is in Studio and I am accessing It through a task.

I have tried """"tect"""" and others...Please help

Aloha

Lou

0 4
0 990