I have a lookup table and record batch Table I would like to do a count on the records stored in that batch by counting the number of records in that batch that have a certain key on the responseKey column. This column keys are stored in the look up table for comparison. So I would like to do a join sql pivot that will use my keys stored in the lookup as columns and count as values

so far I have managed to do this but this is not efficient I would like to fire that sql once not on every count

0 1
0 1.3K

Hi,

The following sql statement is working through the SMP but couldn't make it work through the code.

The table is a linked table to oracle db.

Tried to change the date property in the linked table class from %Date to %String and also tried using %SQL.Statement and %Library.ResultSet

this work through SMP:

INSERT INTO PACKAGE.SOME_TABLE_NAME

(EFFECTIVE_START_DATE,MORE,DATA,HERE)

VALUES (to_date ('2018-04-01','yyyy-mm-dd'),123,456,789)

In the code i'm using '?' in the statement for the parameters.

0 14
0 398

How to convert SQL persistent classes to JSON output - I have tried 1 option but appears to be very lengthy process.

I have many other SQL storage's defined and have to expose them as well to JSON. Can anyone please suggest a better approach.

My column names usually match with my Json properties.

My User.TestClass is the class with GetJsonList() as my method to return /output JSON formatted data.

The Code tried and SQL storage structure are as follows -

1 3
0 967
Question
· Apr 6, 2018
sql insert from cache

I am tasked with using CACHE to insert data retrieved from a CACHE data base and insert it into an sql database. The columns in the sql table that I am trying to insert data into have names that contain underscores such as "ACCESSION_DATE" I found a utility in CACHE to connect to the sql data base and perform inserts. I have the data I need to insert. I need to pass the data into the sql utility referencing the column names.

I tried using indirection to set the data into underscored variables, but that isn't allowed in cache object script.

0 8
0 1.3K

Any insights, news, alternatives or experience about sequence pattern querying like with Oracle's MATCH_RECOGNIZE, more declarative, less simple direct COS way? Both obvious solutions (shadowing data to oracle cloud or implementing MATCH_RECOGNIZE compiler in COS from scratch) seem big overkill. Do Intersystems have plans to adopt this "2007 ANSI standard proposal" and "SQL:2016 standard"

0 3
0 477

Morning guys I have a SQL operation that I use to read data and results to a record map. But seems to have trouble saving the objects to a record map as I get this message

ERROR ErrException:
zInsertObject+2^%Library.RelationshipObject.1 -- logged as '-' number - @''

please help here is my code let me know if I missing anything thank you in advance

0 2
0 565

Hi all,

I am new in Cache. I have to update a record with a long text field, for that, I am using ODBC but the issue is that it is returning an error when I execute the ODBC SQL statement because the field contains some commas, colon, double quotes, single quotes, and CR LF characters.

There is a way to escape this chars? I have seen I can save the field when I replace the single quotes with a double single quote (it's -> it''s) but I can not save the information when the field contains double quote chars. What about the other chars?

0 6
0 1.1K

Hi, Community!

Please find a new session recording from Global Summit 2017:

Optimizing SQL Queries

https://www.youtube.com/embed/nEKYDd2meDM
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

2 0
0 395
Question
· Feb 21, 2018
HL7 segment query using SQL

I'm trying to get a count of specific message type with a specific entry and thought I could build the query in Message Viewer but this does not provide counts (as far as I am aware). So when I take the SQL from 'Show Query' it omits the segment criteria as the code shows below.

I have attached the criteria that has been excluded. Is this possible?

Thank you

0 2
0 1.4K

I came across How to import a tab separated text file into a SQL table programmatically?, which appears to indicate that I can pass the filename and all records will be imported. However, when I put use the Import method only a single record gets imported. However, all records are imported if I use the management console to import the file by selecting it and choosing the options.

Has anyone ran into this in the past?

0 3
0 646
Question
· Feb 15, 2018
The Index on a String field

I noticed that the subscript of the index map is actually the collated field (%SQLUPPER).

Is String the only data type going through this transformation? Any other data type would also go through this transformation?

Thanks.

0 1
0 283

Hi all,

I have an operation which uses the SQL outbound adapter to query a data source set up using a system DSN on the server which uses the Intersystems ODBC35 driver (this is a cache db hosted elsewhere).

Whenever Ensemble runs the following query:

SELECT lnkdid,
c_fastsearch_code,
c_drugfull
FROM JAC.drug_basic
WHERE c_drugfull LIKE 'Para%'

No data is returned, however running the same query via SQL Server Management Studio, all expected rows are returned.

Also if I run the following via Ensemble:

0 7
0 613
Question
· Feb 9, 2018
SQL prepare error

I'm trying to learn how To use SQL in CACHE, so I hope I don't bore you with "Dumb" questions....

I'm getting "ERROR #6022: Gateway failed" message following this line of code.

s sc=gc.Prepare(hstmt,pQuery) 

This line of code comes from an example I found in the documentation. pQuery is the "Select" statement setting up the variables and tables I'm trying to pull information from.

What does that error indicate?

Thank you.

0 5
0 1.1K

I've mapped multiple tables (UNION on mapped SQL classes) into a view, using CREATE VIEW.

Through ODBC, in Entity Framework, I am querying against that view and offering paging. The paging is implemented using IQueryable.Skip and IQueryable.Take.

Skip seems to have unexpected results, I believe due to incorrect SQL generated by the Entity Framework provider, though perhaps I've done something incorrectly. The generated SQL looks similar to this (with some bits replaced or altered for security reasons), the basic structure is unaltered.

0 11
0 667
Question
· Jan 15, 2018
using sql link table wizard

I'm trying to create an sal connections from one cache system to another. I've created the connection part and I think that is working. When trying to link a table through the link table wizard, I'm getting an error "<MAXSTRING>zCreateOneLinkTable+52^%CSP.UI.SQL.LinkWizardResultPage1.

Is this due to my global block size in the new system not being large enough? It is currently set at 8192.

Thank you

Mike

0 2
0 536