Is it OK to use this partially rebuilt index if I don't care about data that isn't indexed? Did you do this before?

I didn't build indexes manually, except for tests. If the index is not built for all data, then the query will see only the data for which the index exists.

 
Try simple example:

If we open the source code of the class for the Status field, we will see the following:

Class Ens.DataType.MessageStatus Extends %Integer
{

Parameter DISPLAYLIST = ",Created,Queued,Delivered,Discarded,Suspended,Deferred,Aborted,Error,Completed";

Parameter VALUELIST = ",1,2,3,4,5,6,7,8,9";

}

Therefore , the following conclusions can be drawn:

  1. For Embedded SQL the RuntimeMode is Logical
  2. For SQL Explorer (Portal) the RuntimeMode is Display

Hence the leapfrog in the results.

Try this:

ClassMethod OnStartRequest() As %Status
{
  #dim %response As %CSP.Response
  
  ;s %response.ContentType="text/html",%response.Expires=-1
  %response.Status=##class(%CSP.REST).#HTTP403FORBIDDEN
  q $$$OK
}

Or this:

/// Event handler for <b>PreHTTP</b> event: this is invoked before
/// the HTTP headers for a CSP page have been sent.  All changes to the
/// <class>%CSP.Response</class> class, such as adding cookies, HTTP headers,
/// setting the content type etc. must be made from within the OnPreHTTP() method.
/// Also changes to the state of the CSP application such as changing
/// %session.EndSession or %session.AppTimeout must be made within the OnPreHTTP() method.
/// It is prefered that changes to %session.Preserve are also made in the OnPreHTTP() method
/// as this is more efficient, although it is supported in any section of the page.
/// Return <b>0</b> to prevent <method>OnPage</method> from being called.
ClassMethod OnPreHTTP() As %Boolean ServerOnly = 1 ]
{
  %response.Status="403 Forbidden"
  0
}

We need to look at your full code, since there is nothing suspicious in the specified piece of code. I made a small example and there is no highlighting of the last line:

 
Source code

I confirm (used the following code):

#include %systemInclude
n
try{

  sql="select * from (select 0 field union select 1) where 0=1"
  
  #dim rs As %SQL.StatementResult=##class(%SQL.Statement).%ExecDirect(,sql)
  rs.%SQLCODE
  
  s st ##class(%SQL.Statement).%New()
  $$$ThrowOnError(st.%Prepare(sql))
  rs st.%Execute()
  !,"---",!,rs.%SQLCODE
  
  &sql(select * from (select field union select 1) where 0=1)
  !,"---",!,SQLCODE

}catch(ex){
  "Error "ex.DisplayString(),!
}

Output:
0
---
0
---
100

Quote from the documentation:

When retrieving results, first check for successful execution by examining %SQLCODE. For many statement types, success/failure is all that is needed. The %SQLCODE property contains the SQL error code value. Successful completion values are 0 (successful completion) and 100 (the operation has either found no data or reached the end of the data).proof

My choice of a comparison tool was determined by the OS on which Studio is running. But you are free to choose something more platform-independent, such as Java or Qt.

By the way, SQL Data Lens (written in Java) already has the ability to view and upload sources to a file. It would be nice to add integration with a third-party tool for comparing items (by analogy with Studio).

I hope @Andreas Schneider will read this wish.

This Compare only works when working with the studio, correct?

Yes, Studio does the following:

  1. uploads the first source code to a temporary directory (for example c:\windows\temp)
  2. uploads the second source code to a temporary directory
  3. starts WinMerge by passing in the command line links to previously uploaded files: WinMerge Command line

You can do all this yourself from a batch file.
In this case, you can compare items not only in different databases, but also on different servers.

You can use Caché SQL Gateway (Link Table via JDBC or ODBC)
This, your data migration query will be of the form:

insert into mssql.table(field1,..,fieldNselect field1,..,fieldN from cache.table

Or use third-party utilities to migrate data from/to any DBMS via JDBC/ODBC, for example SQL Data Lens (aka Caché Monitor): Local query cloud (there is a video)

Also there the Bulk Export

@Andreas Schneider - the author of this tools