SQLCONNECT1 = tableUsers
SQLCONNECT2=tableLogEntries
select * from tableusers u, tablelogentries e where e.userid = u.userid
I keep getting the error References to an SQL Connection must constitute a whole subquery
SQL is a standard language for storing, manipulating and retrieving data in relational databases.
SQLCONNECT1 = tableUsers
SQLCONNECT2=tableLogEntries
select * from tableusers u, tablelogentries e where e.userid = u.userid
I keep getting the error References to an SQL Connection must constitute a whole subquery
I've setup ODBC connection so I can access Cache data within SQL Server.
I want to be able to write SQL queries for internal monitoring purposes, similar to what's possible with SQL Server. Specifically I want to be able to check mirroring status (i.e. check which is the current primary mirror member), check the status of any Ensemble productions (started/stopped), check the status of business hosts etc. I want to do all of this from SQL Server to go with our other system monitoring solutions.
Does anybody know if this is possible, and if so the names of tables/namespaces which might store
Hello community! I have to work with queries using all kinds of methods like embedded sql and class queries. But my favorite is dynamic sql, simply because of how easy it is to manipulate them at runtime. The downside to writing a lot of these is the maintenance of the code and interacting with the output in a meaningful way. In an effort to have as much dynamism as possible so that we're not rewriting code constantly, and so that we have as little code possible (while still making sense and getting the job done), I made a function that takes in any dynamic query and outputs a dynamic object.
T
I'm having trouble accessing the snapshots EnsLib.SQL.Snapshot in %Library.ListOfObjects that are returned from method ExecuteProcedure in EnsLib.SQL.OutboundAdapter. The Microsoft SQL stored procedure I am executing returns multiple resultsets.
The issue I am having is that my code works fine when executed in the business operation (commented out in the code below) but when it is executed in the business process it errors. Any ideas as to why this happens? The error I get is:
> ERROR #5002: Cache error: <METHOD DOES NOT EXIST>zGetAt+5 ^%Library.ListOfObjects.1
The select query here "select Settings from Ens_Config.Item" in the SQL Query of management portal returns this:
ValidationHost 7ActOnTransformErrorHost1 ReplyCodeActionsHostE=D AlertOnErrorHost1 9 AlertGroupsHost$LabAlertGroup,1-CriticalAlertGroup BusinessPartnerHost
How do I isolate just one of the settings e.g. ReplyCodeActions or LocalInterface
For example, i want to search for all entries that have a value for ReplyCodeActions
I realize i can open the production in studio and search for those setting values.
Hi guys!
As you know there are two (at least) ways to get the stored value of the property of InterSystems IRIS class if you know the ID of an instance (or a record).
1. Get it by as a property of an instance with "Object access":
ClassMethod GetPropertyForID(stId As %Integer) As %String
{
set obj=..%OpenId(stId)
return obj.StringData
}2. Get it as a value of a column of the record with "SQL access":
Hello,
When i click on the menu to run the Data import wizard from MP, i receive following CSP error
| <UNDEFINED>zOnPageHEAD+229^%cspapp.exp.utilsqleximwizardcontent.1 *schemaname : CSP Error |
It is happening for all the namespaces. Looks like some permission issue. Same issue with Data Export wizard. Help to resolve this will be appreciated.
I am using
Cache for Windows (x86-64) 2017.2.2 (Build 865_0_18763U)
Thanks,
Jimmy Christian.
Referencing this post:
https://community.intersystems.com/post/producing-json-sql
I'm not sure how to actually interact with the result set I get from doing something like this. I want to return something like:
[{"field1":1, "field2":2}, {"field1":2, "field2":10}]
I'm finding it very difficult to get it in this format, since %Print appends a newline onto the end of the {} object it prints.
Here's the closest I've gotten:
set query = "select JSON_OBJECT('field1': field1, 'field2":field2) from MyTable where x=? and y=?"
set tStatement = ##class(%SQL.Statement).%New()
set qStatus =
I tryinfg to alter a column definition data type with a user that seems that doesnt have priviledges, but the user has this priviliedge.
Documentation:
Privileges and Locking
The ALTER TABLE command is a privileged operation. Prior to using ALTER TABLE it is necessary for your process to have either %ALTER_TABLE administrative privilege or an %ALTER object privilege for the specified table. Failing to do so results in an SQLCODE -99 error (Privilege Violation). You can determine if the current user has %ALTER privilege by invoking the %CHECKPRIV command.
HI
How to force a specific index in SQL?
Hello all,
I have a Recordset object which contains data from a table "XYZ".
Currently i use this object to extract data using %Get(COL1,COL2...) in a loop and than pass it to a function which inserts the data into another dynamically created Table "ABC" for each record. This takes a lot of time when 100's of records.
Is there a way i can directly copy a RecordSet to a dynamic table without looping through..?
Something like copy Recordset (COL1,COL2..)--> "ABC"
Thanks,
Jimmy
Say I have a property in a persistent class that stores list of colours and I would like to query that field and return a list and be able to loop that list to get individual colours how will l go about achieving this I have tried something like this but its not working as expected
&sql(SELECT colour INTO :colourList FROM favouritecolours)
While (SQLCODE = 0)
{
for i=1:1:$LENGTH($P(colourList,","))
{
set fvalue=$P(colourList,",",i)
write "the first"_fvalue,i,
}
}
the query returns colours but its just a string no delimiter eg;
green red blue
I have tried with
&sql(SELECTI used Cache 2016.
I used the following statement to sort after paging, but suggested an error:
SELECT *
FROM
(SELECT sslog.userRowid,
sslog.CreateDate,
sslog.CreateTime,
Sslog.SSUSR,
sslog.Terminal,
ssuser.Initials,
ssuser.USName
FROM SUser_Log sslog
LEFT JOIN DHC_SSuser ssuser ON (Sslog.SSUSR = ssuser.userRowid
OR sslog.ssusr = ssuser.Initials
OR sslog.ssusr = ssuser.USName)
WHERE ssuser.USName ['admin'
ORDER BY sslog.CreateDate DESC)End users sure love Excel tables. So, how can you deliver the second to the first? Read this post to find out.
Hi everyone,
Im new in cache, i came from Java and im missing some features that i couldn't find in the documentation, I hope you can help me with this questions.
Just a brief introducction:
- Im in a project with old cache version, so saddly i can't use Eclipse + Atelier, so im using Studio.
- Currently im in a project with persistent classes, we want to turn apart the globals and focus on tables.
The questions:
Is there any way to make something like hibernate for cache %Persistent classes?
Hi All,
I have two tables LB_TestSet and LB_Transfer
LB_Transfer has a list if TestSet row IDs, so i am doing the following join
SELECT
LBTS_RowID,
,LBTS_CollectedDate
FROM SQLUser.LB_TestSet
JOIN SQLUser.LB_Transfer ON ($LISTBUILD(LBTS_RowID) %INLIST LBTR_TestSetList)
WHERE LBTS_CollectedDate BETWEEN '2019-01-01' AND '2019-05-10'
Without the date filter the query returns data, but if i add the date filter no data is returned
I also tried using %INTERNAL, %EXTERNAL TO_DATE('2009-01-01','YYYY-MM-DD')
if i filter by RowID for example the filters work.(this is to make sure that the where
here is my trigger:
CREATE TRIGGER "SQLUser".SYM_ON_U_FOR_SYM_CHNNL_125123 AFTER UPDATE ON "SQLUser"."sym_channel" REFERENCING OLD ROW AS OLD NEW ROW AS NEW FOR EACH ROW DECLARE @var_row_data VARCHAR(16336); WHEN ( 1 = 1 and 1 = 1 ) -- I will use OLD/NEW alias here set @var_row_data = ''; LANGUAGE sql insert into mytable (id, data) values(1, @var_row_data);
here is error message:
ERROR: [SQLCODE: <-400>:<FATAL ERROR >] [Location:
Have some free text fields in your application that you wish you could search efficiently? Tried using some methods before but found out that they just cannot match the performance needs of your customers? Do I have one weird trick that will solve all your problems? Don’t you already know!? All I do is bring great solutions to your performance pitfalls!
As usual, if you want the TL;DR (too long; didn’t read) version, skip to the end. Just know you are hurting my feelings.
If you open up your version of Sample.Company in the SAMPLES namespace of a recent (2015.1 or later)
Hi! I've been fiddling with linked tables to get data from other servers, and I encountered a problem that I'm curious about. Maybe I'm not using these tools as intended or there's more going on, so I'm asking here.
I'm running a query on linked table A, something simple like this:
select name from A where id = 5983658923646
And I get this error:
[SQLCODE: <-400>:<Fatal error occurred>]
[%msg: <>]
If id, or anything comparison, is something smaller like 4345, it works just fine. It's only when the where reaches a certain length, not just id, that it fails.
After switching Dialects from CACHE to
Hi!
I was trying to create a query that can be exposed as a stored procedure (function actually) that would return a resultset with a random number of columns.
Unfortunately, it seems that unless I specify the ROWSPEC annotation on the Query method, I won't get any columns exposed. I was hoping to implement QueryNameGetInfo method and specify the names and number of columns I would be returning dynamically. But it seems that GetInfo information is simply ignored.
Here is my code:
Class Test.Test
{
ClassMethod MyCustomQueryClose(ByRef qHandle As %Binary) As %Status
{
Quit $$$OK
}Cache version: Cache for Windows (x86-64) 2017.2.1 (Build 801_3U)
Good Afternoon,
I have a co-worker who is trying to run the below query via ODBC. The issue is that the query appears to be running extremely slow (nearly 2 hours).
Below is the generated query plan
|
Class ICT.Experiments.A Extends %Persistent
{
Property Name As %String;
Property Collection As list Of ICT.Experiments.B;
Property Collection2 As array Of ICT.Experiments.C;
}
Class ICT.Experiments.B Extends %Persistent
{
Property Name As %String;
}
Class ICT.Experiments.C Extends %Persistent
{
Property Name As %String;
}I have the classes above and I can select columns from the array collection by using two joins as follows:
SELECT
mainTable.ID, mainTable.Name, c.Name
FROM ICT_Experiments.A mainTable
LEFT JOIN ICT_Experiments.A_Collection2 arrayTable ON arrayTable.A =
Hello all,
I am still learning CACHE and have below question.
In one of my ZEN method i am creating a table using
&sql(CREATE TABLE xxxxx(TNAMESPACE CHAR(100),TINTERFACE CHAR(100)))
Does any one knows how to concatenate a $USERNAME or any content of a variable to the name of table ?
&sql(CREATE TABLE xxxxx_$USERNAME(TNAMESPACE CHAR(100),TINTERFACE CHAR(100))) is not WORKING.
Thanks,
Jimmy Christian.
I have two classes:
Class Example.Parent Extends %Persistent{Property Name As %String;Property Description As %String;
Property Children as list of Example.Child;
}Class Example.Child Extends %Persistent{Property Name As %String;Property Description As %String;
}
A parent can have many children. I want to query for parents and add children for each parent to my result.
Here is the code that I query with:
Class Example.QueryParents [ Abstract ]{ClassMethod QueryParents() As %String{ Set query = "SELECT %ID ID, Name, Description FROM Example.Parent"Hello,
I am trying to run a simple SELECT STATEMENT in USER NAMESPACE.
SELECT * FROM projectname.table
What is the syntax if i need to get data for a table in another namespace eg. SAMPLES., SYS
SELECT * FROM SAMPLES.projectname.table is not working.
Thanks in advance.
Jimmy Christian.
We use a lot of external MS SQL calls to look up numerous things when it comes to HL7. I am running into an issue where the outbound calls are queued but the message is sent onto the next process before it gets a response. How do I get it to wait till the response gets back from the MS SQL call before sending it onto the next process?
Below is a screen shot of what I am trying to explain...Select Research Study executes at 8:33 the message is sent to the next process at 8:34, but the response of the MSSQL call doesn't come till 9:31.
.png)
Hello everyone!
I need to have a ResultSet of type % SQL.Statement show its contents when it is trafficked in a message property by Business Process.
I tried to use the % XML.DataSet type that inherits properties of type % XML.Adaptor, but did not work.
Is there any other way to traffic as an object, other than within a Stream?
Note: I can not traffic Streams and I will not be able to use Correlate in this case.
I use Documatic a lot to generate class documentation from comments embedded in the code. Is there a good way to create documentation for SQL views as well? Ideally I want to document each column in the view with HTML markup similar to how I document each method of a class with Documatic.
Hi all,
In order to prioritize functional requirements for evolving our SQL developer experience, we have prepared a short survey to better understand how you’re currently using and, in an ideal world, would like most to interact with our SQL platform.
https://www.surveymonkey.com/r/DSY6YT2
Don’t hesitate to forward this survey informally to your peers you know are accessing our SQL engine on a regular basis. There’s a disclaimer at the top that indicates we are highly interested in feedback to drive our roadmap, but obviously cannot commit to implementing all of it.
The survey is anonymous, but
Hi! We have received a request to create a new rule on CachéQuality to identify when a developer uses double quotes (" ") within any SQL statement.
We have been asked many times about SQL validation rules, and we would like to open a debate to allow everyone discuss what would you like to be checked on a SQL statement.
Current examples are for basic situations:
Set stmt = ##CLASS(%SQL.Statement).%New()
Set query = "Select Val1, Val2 FROM Table WHERE Val1=""SomeCondition"""
&SQL(SELECT Val1, Val2
INTO :val1, :val2