Hi Eduard !

Being a little bit lazy I simplified the query (for less typing)
My example: 

SELECT * FROM %Dictionary.StorageDataValueDefinition
where id [ 'Sample.Person'

And it works fine for persistent and serial classes.
My hidden assumption: there is only 1 Storage Strategy.

The nice point about:
you get also storage locations of deleted (!!) properties  
that eventually might be invisible in class definition.
 
yes yes

Assumimg you have both DB on the same instance but different namespaces "FROM" and "TO"

You may run a loop like this

set id=""
for cnt=1:1 {
  set id=$ORDER(^|"FROM"|Data(""),1,value) quit:id=""
  set ^|"TO"|Data(id+10000000)=value)
  if cnt#100000 write cnt,?10,id,!
}

For the connections of the host you may use ECP

For a more structured global you might need to use $QUERY()

The write is just to see progress

You may define properties by writing to ##class(%Dictionary.PropertyDefinition)
as part of a ##class(%Dictionary.ClassDefinition) 
http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P...

Parameters is then defined as array of %CacheString;  

And you set it just as any other array.  [SetAt() ..... ]

and then compile the class to use that property inside the class
 
This is nothing you may do on the fly.
 

YES it is !

Class %DeepSee.ResultSet has a method %CancelQuery that does the trick.

http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P...

http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P...

Chapter  Using the Result Set API tells you some more details.
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

especially:

If you used %ExecuteAsynch(), periodically check to see whether the query has completed. If the query uses any plug-ins, make sure that any pending results are also complete; pending results are the results from the plug-ins, which are executed separately from the query.

To determine the status of the query, call the %GetStatus() method of your instance. Or call the %GetQueryStatus() class method of %DeepSee.ResultSet. These methods return the status of the query and also (separately) the status of any pending results; see the class documentation for details.

Optionally, to cancel a query that has not yet completed, call the %CancelQuery() class method.

A practical example is seen in ##class( %DeepSee.UI.Analyzer). onunloadHandler()

Hi Scott,

analyzing  ##class( EnsLib.SQL.Common).ExecuteProcedureParmArray(.....)
I think you should be able to provide a prepared Snapshot to set  the required parameters.

At least $$$sysTRACE("Using initialized SnapShot "_(tNumRS+1))  points in this direction

So your code might look like this:

Set SelectPER355MC=##class(%ListOfObjects).%New()
Set preset=##class(EnsLib.SQL.Snapshot).%New()
Set preset.MaxRowsToGet=12000
do SelectPER355MC.SetAt(preset,1)

set tSC = ..Adapter.ExecuteProcedureParmArray(.SelectPER355MC,.output,SPQuery,"oi",.parm)

I have no environment to check the approach.
So it's up to you to verify it.

 ERROR 5540 - User "UnknownUser" is not privileged for the operation.
This tells me that you don't login with a managed user with enough privileges.

So you could have a dedicated user just for this purpose.
OR
give "Unknown User" enough rights
OR
make use of a Privileged Application to assign temporary required Resources (my guess "%Developer") 

more on this and pp.
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.PortalHelpPag...

Hi Ken,

There is an easier way.

Instead of fiddling around with unpredictable params you just pass your whole symbol table = local variables
to your background job like this and use what you need in background

JOB ##class(%SYSTEM.OBJ.FM2Class).All():(:1):5

look for process-params + switch  here
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...