I guess it looks like we don't support CodeMode = generator for overriding property methods. CodeMode = code should work, but you need to access type parameters from the property definition in order to generate the proper code. I believe you will need to extend the %String datatype and override Normalize, then use the new datatype class in your property definition. Here is an example:

Class User.StringoNoEmpty Extends %String [ Language = objectscript ] {

ClassMethod Normalize(%val As %RawString) As %String [ CodeMode = generator, ServerOnly = 1 ]


    set code="%val"
    if %parameter("TRUNCATE"),%parameter("MAXLEN")'="" { set code="$e(%val,1,"_(+%parameter("MAXLEN"))_")" }
    $$$GENERATE("    RETURN $tr("_code_",$c(0),"""")")
    RETURN $$$OK


Property myString As User.StringoNoEmpty(MAXLEN = 54, TRUNCATE = 1);

Hope this helps,


Can you be a little more specific? Are you are asking about embedded SQL, dynamic sql, ODBC, JDBC,  or limits for each interface?

The answer is different for each, although I'm not sure there is an exact length limit.  For embedded SQL, I don't believe there is any limit other than the maximum size of the code you can define for a .MAC routine or class method.

I believe for dynamic SQL the max length should be pretty close to the maximum string length supported by your Caché instance.  I was able to Prepare a using %SQL.Statement that was a bit over 3,600,000 characters in length (using IRIS, I don't have immediate access to a Caché instance))

Hi Suman,

For the case where the ID is not system generated, try the following query after a successful INSERT:


You can actually do this for the case where the ID is system generated also, but in that case getGeneratedKeys is probably a better option.

 LAST_IDENTITY() simply returns the value of the %ROWID variable, which is set after a successful INSERT to the value of the rowid field.

$system.SQL.TODATE() converts a readable format into a logical %Date value (+$Horolog).

$system.SQL.TODATE() does support converting from Julian date to %Date if you use the "J" format.  However, there is one issue; the value is returned in YYYY-MM-DD format for dates prior to 1841-01-01.  I will make a note to correct this.


USER>for Julian=2393465:1:2393475 w !,$SYSTEM.SQL.TODATE(Julian,"J")


"J"ulain format is also supported for $SYSTEM.SQL.TOCHAR():

USER>set string="2017-08-13" write !,$SYSTEM.SQL.TOCHAR(string,"J")   

This same issue was reported a week or two ago to the WRC.

Purging cached queries should clear the issue.

It appears to be an issue where the server gets into a state where the cached query class gets an error during creation (that is not reported) and the class is created without any methods.  I believe that customer was on version 2014.1.  Can you please let us know what version you saw this problem on?

Also, if you can reproduce the issue, please contact the WRC with the details.  Thank you.

Also, %SYS.SQLSRV is a routine, not a class, which is why you could not find information on it in documatic.

Is is possible you have a version mismatch here?

There is a new parameter for %Library.Integer called STRICT, but I believe this is only in version 2016.2 and up.

I don't have much knowledge about mirroring, but if your main system was a 2016.2 field test version, and your mirrored system was 2016.1.2, the 2016.1.2 system would not recognize STRICT as being a valid type parameter for %Integer properties.

Perhaps I'm not fully understanding what you are asking for, but why doesn't using a string datatype work for you?

SAMPLES>>create table kev (mynum varchar(10))
1.    create table kev (mynum varchar(10))

0 Rows Affected
statement prepare time(s)/globals/lines/disk: 0.0084s/2003/16386/0ms
          execute time(s)/globals/lines/disk: 0.0838s/46277/360501/0ms
SAMPLES>>insert into kev (mynum) values ('300.6000')
2.    insert into kev (mynum) values ('300.6000')

1 Row Affected
statement prepare time(s)/globals/lines/disk: 0.0108s/2772/28131/0ms
          execute time(s)/globals/lines/disk: 0.0002s/13/153/0ms
SAMPLES>>insert into kev (mynum) values ('200.100')
3.    insert into kev (mynum) values ('200.100')

1 Row Affected
statement prepare time(s)/globals/lines/disk: 0.0011s/49/2516/0ms
          execute time(s)/globals/lines/disk: 0.0007s/3/153/0ms
SAMPLES>>insert into kev (mynum) values ('643.1230')
4.    insert into kev (mynum) values ('643.1230')

1 Row Affected
statement prepare time(s)/globals/lines/disk: 0.0006s/49/2526/0ms
          execute time(s)/globals/lines/disk: 0.0001s/3/153/0ms
SAMPLES>>select mynum from kev
5.    select mynum from kev


3 Rows(s) Affected
statement prepare time(s)/globals/lines/disk: 0.0622s/45809/254912/0ms
          execute time(s)/globals/lines/disk: 0.0002s/16/523/0ms
SAMPLES>>cos zw ^User.kevD

Hi Andy,

Have the tables used by the query been tuned?  If not, I would suggest tuning the tables.

In the Management Portal, System Explorer -> SQL, switch to the proper namespace and then enter the query text in the Execute Query tab and press the Show Plan button.  Now do the same with the query that selects just a single column and compare the query plans.  Are they different? 

If they are different, post the query plans here so we can have a look.

Possible other issues:

- Are any of the fields in the multi-field select list computed, and could the computation be taking a long time?

- Is the table using default storage, or %CacheSQLStorage?  If %CacheSQLStorage, do any of the fields in the multi-select field list have expensive data retrieval logic?

- Are the tables in the from clause all base tables, or are views involved? 

- Do the fields in the select list come from the same table?