That's weird. When I run a query, I cannot send messages directly to the table from the query. I need to first make that table into a data table. See example below. Am I misunderstanding something?
Table = New SQL Query(
Version( 130 ),
Connection( "ODBC:DSN=yournamehere;" ),
QueryName( "MyQuery" ),
Select(
Distinct,
Column( "A", "t1" ),
),
From(
Table(
"some table",
Schema( "some view" ),
Alias( "t1" )
),
Table(
"another table",
Schema( "another view" ),
Alias( "t2" ),
Join(
Type( Left Outer ),
EQ( Column( "BatchId", "t1" ), Column( "BatchId", "t2" ) )
)
)
)
) << Run;
// does not work
Close( Table, no save );
// does work
NewTable = Data Table( Table );
Close( NewTable, no save );
Ah, I think I have a faint idea now what might have caused this problem:
Table = New SQL Query(
Version( 130 ),
Connection( "ODBC:DSN=yournamehere;" ),
QueryName( "MyQuery" ),
Select(
Distinct,
Column( "A", "t1" ),
),
From(
Table(
"some table",
Schema( "some view" ),
Alias( "t1" )
),
Table(
"another table",
Schema( "another view" ),
Alias( "t2" ),
Join(
Type( Left Outer ),
EQ( Column( "BatchId", "t1" ), Column( "BatchId", "t2" ) )
)
)
)
) << Run Foreground; // this fixed it
// does work
Close( Table, no save );