I think XML would be the best way, especially if you want to do it programmatically. This snippet will export your table to the specified folder

ClassMethod ExportTable(table As %String, path As %String)
	set class = $replace($replace(table,"_",""),"SQLUser.","User.")
	set sqlQuery = "select $listbuild(%Id,'"_class_"') as oid from "_table
	set rset = ##class(%SQL.Statement).%ExecDirect(,sqlQuery)
	while rset.%Next() {
		set elements(rset.%Get("oid"))=""
	do ##class(XML.Element).Export(.elements, path_"/"table_".xml", "r")

And then you import it on the other instance with:


The advantage of this solution is that it uses %GUIDs as identifiers, as such you can add/edit data on your target system and it won't be overwritten when importing the file. 

An alternative way without having direct access to file system would be use a JDBC client with export functionality. I use DBeaver and you can right click on your query/table -> Execute -> Export from query:


Do you initialize your target variable as an instance of an object that has Name property? The following snippet works for me

Class Custom.Test Extends %RegisteredObject
Property Name As %String; 

ClassMethod SQL()
    set target = ##class(Custom.Test).%New()
    &sql(SELECT 'TestName' INTO :target.Name FROM MainFrame.EmployeeRecord)
    write target.Name

Also, assuming you are running your test in console, you can issue write $zerror it will tell you which property is missing (could be related to something in the source rather than the target)

Michael has not followed anybody yet.
Global Masters badges: