Execute TMSL in SSMS

Hammad Ahmed 0 Reputation points
2025-02-24T05:52:34.35+00:00

I have a tmsl code which looks something like this:

{
  "createOrReplace": {
    "object": {
      "database": "TabularProject1"
    },
    "database": {
      "name": "TabularProject1",
      "compatibilityLevel": 1600,
      "model": {
        "culture": "en-US",
        "dataSources": [
          {
            "type": "structured",
            "name": "SQL/my_server_name;empDB",
            "connectionDetails": {
              "protocol": "tds",
              "address": {
                "server": "my_server_name",
                "database": "empDB"
              },
              "authentication": null,
              "query": null
            },
            "credential": {
              "AuthenticationKind": "UsernamePassword",
              "kind": "SQL",
              "path": "my_server_name;empDB",
              "Username": "sa",
              "EncryptConnection": false
            }
          }
        ],
        "tables": [
          {
            "name": "employees",
            "columns": [
              {
                "name": "emp_id",
                "dataType": "int64",
                "sourceColumn": "emp_id"
              },
              {
                "name": "emp_name",
                "dataType": "string",
                "sourceColumn": "emp_name"
              }
            ],
            "partitions": [
              {
                "name": "Partition",
                "dataView": "full",
                "source": {
                  "type": "m",
                  "expression": [
                    "let",
                    "    Source = #\"SQL/my_server_name;empDB\",",
                    "    dbo_employees = Source{[Schema=\"dbo\",Item=\"employees\"]}[Data]",
                    "in",
                    "    dbo_employees"
                  ]
                }
              }
            ]
          }
        ],
        "annotations": [
          {
            "name": "ClientCompatibilityLevel",
            "value": "700"
          }
        ]
      }
    }
  }
}

I want to exeucte it in ssms. I right click on Analysis Service Engine in SSMS, then New Query then XMLA. But when I paste this json format code there I get this error on the very first curly bracket with a red squiggly line:

Invalid token 'Text' at root level of document.

And following error with a red squiggly line at the very last curly bracket:

XML must contain a root level document.

Also when I execute this script I get following error:

Executing the query ...
The following system error occurred:  A device attached to the system is not functioning. 
Session cancelled per end session header in user request.
Session cancelled per end session header in user request.
Run complete

Please note that my sql server is 2022 and compatibility level 1600. My_server_name is actually another server where sql server database is installed and that database is the datasource to my tabular model. Also in that same server is analysis serivce is installed where I want to build TabularProject1 database.

Any help in this regard is highly appreciated. Anyother method of creating database will not work.

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,323 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 46,196 Reputation points
    2025-02-24T07:46:11.05+00:00

    XML/A = "XML for Analysis Services" is so called, because it is XML and not JSON, See

    https://learn.microsoft.com/en-us/analysis-services/xmla/xml-for-analysis-xmla-reference?view=asallproducts-allversions

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.