The new key did the trick. Thanks for the quick response! 

Note that applying the new IRIS for Health key (I haven't tried plain IRIS) yields a warning that it lacks some of the analytics features of the expiring key.

...or using a stored procedure along these lines:

ClassMethod RenameTable(oldName As %String, newName As %String) As %String [ SqlProc ]
{
   try {
      &sql(select %ID into :className
         from %Dictionary.ClassDefinition
         where SqlTableName = :oldName
      )
      if SQLCODE set status = "Error: Table '" _ oldName _ "' not found." quit

      set classDef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
      set classDef.SqlTableName = newName
      set saveStatus = classDef.%Save()
      set status = $case(saveStatus, 1: "OK", : "Error: " _ $system.Status.GetErrorText(saveStatus))
   } catch {
      set status = "Error: " _ $zerror
   }
   return status
}

Note: This doesn't handle the special case where there is no 'SqlTableName' defined.

Hi Dimitry,

Was the webinar recorded? I'd say you'll get at least another 80 viewers if you publish it...

Cheers,

Otto

Agreed, and if you want to have your cake and eat it, too:

if (a) { set b = a }

Somewhat off-topic, there are reasons to watch out for %OnBeforeSave():

  • The object is already serialized at this point, so you can't change any properties.
  • The method is only triggered if the object was changed.

%OnAddToSaveSet() has neither of these gotchas (but you don't have %Id() there either, of course).

...and don't forget to kill the global when you're done. On a busy system, the log file could grow very large.

Otto