The SQL engine is unable to directly identify TMSL. Consider setting up an SQL job, and within SSMS (SQL Server Management Studio), configure a Linked Server for the SSAS (SQL Server Analysis Services) instance.
Amend the stored procedure to convey the TMSL command to the Linked Server using JSON.
CREATE PROCEDURE ProcessMonthlyPartition
AS
BEGIN
DECLARE @CurrentMonth NVARCHAR(20)
DECLARE @PartitionName NVARCHAR(100)
DECLARE @JsonCommand NVARCHAR(MAX)
DECLARE @CurrentYear NVARCHAR(4)
DECLARE @DataBaseName NVARCHAR(100) = 'dev-ssas'
DECLARE @TableName NVARCHAR(100) = 'fact_viewing_session_member'
SET @CurrentMonth = DATENAME(MONTH, GETDATE())
SET @CurrentYear = DATEPART(YEAR, GETDATE())
SET @PartitionName = 'Partition_' + @CurrentMonth + '_' + @CurrentYear
SET @JsonCommand = '{
"refresh": {
"type": "automatic",
"objects": [
{
"database": "' + @DataBaseName + '",
"table": "' + @TableName + '",
"partition": "' + @PartitionName + '"
}
]
}
}'
EXEC (@JsonCommand) AT SSASTABULAR; -- linked server name
END