Search code examples
t-sqlssas-tabular

process table from SSAS tabular in tsql, and get back number of rows transferred (inserted)


I would like to process the table from a SSAS Tabular model individually through a TSQL Script

I've found the way to do it, but now I'm missing a way to get back the number of rows updated... When doing it over the gui (ssms), it gives back that number, now I'd like to do the same...

DECLARE @Command VARCHAR(MAX) 
SET @Command = '
{
  "sequence": {
    "operations": [
      {
        "refresh": {
          "type": "dataOnly",
          "objects": [
            {
              "database": "test",
              "table": "D_Status",
            }
            ]
        }
      }
    ]
  }
}'
EXEC (@Command) AT [server\TABULAR];

I would expect a kind of rowcount, but this is not working (always return 1)

PRINT 'Record count: ' + CONVERT(varchar, @@ROWCOUNT)

Solution

  • The number of rows shown in the GUI is the same as the total number of rows in the table (not just the updated / new rows).

    So you could copy the queries from the cube and count the rows from them. You might want to use a DMV to get the queries behind all the tables like described here :How to find lineage between SSAS (Tabular Model) and SQL database