Home > other >  DMV request for "Description" of the table for Power BI dataset
DMV request for "Description" of the table for Power BI dataset

Time:01-15

What I am trying to achieve is to add tables and columns descriptions programmatically to a Power BI dataset.

For this reason, I use Server Analysis Services to get access to the metadata. I run a simple request:

select *
from $System.TMSCHEMA_PARTITIONS

As a result, I get a table with columns names:

  1. ID
  2. TableID
  3. Name
  4. Description
  5. ....

Now I want to select where the "Description" is empty.

select *
from $System.TMSCHEMA_PARTITIONS 
where Description IS NULL

But I can't, I always get a syntax error:

Query (3, 7) The syntax for 'Description' is incorrect.

SQL reads it as a command and I don't know how to avoid it. I have tried adding quotes and double quotes to the name of the columns, I tried adding a table reference and all of these combined, but nothing helps.

It works for "TableID" for example.

CodePudding user response:

This should work and as to why IS NULL does not work, my best guess is the data type for Description does not print NULL values. They are all ''

select *
from $System.TMSCHEMA_PARTITIONS
where [Description]=''

CodePudding user response:

This one works:

select *
from $System.TMSCHEMA_PARTITIONS 
where len([Description]) = 0
  •  Tags:  
  • Related