1
votes

I created my tabular model with SSAS and Now I'm looking for a solution to refresh it automatically. So I have some questions :

could we process our tabular model with a stored procedure T-SQL calling the TMSL script ?

An example will be helpful

Thank's

1

1 Answers

1
votes

Yes. This article explains how to setup a SQL Server linked server that connects to SSAS. Once that's done, you can run this:

declare @xmla varchar(max) = '
{
  "refresh": {
    "type": "full",
    "objects": [
      {
        "database": "YourDatabaseName"
      }
    ]
  }
}
';

exec (@xmla) at SSAS;

This approach lets you write some logic to execute different TMSL scripts daily. For example you could refresh only the current year partition.

If you want to execute a static script then a SQL Agent job is another way to go.