Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Permission is required to run this native database query -> Never Resolves

I have a query which I've insterted a List (converted to CSV) into.  When I update the M-Query, i get an alert: Permission is required to run this native database query (which is expected).  When I choose the [Edit Permission] button I can see that my M-Query has produced valid SQL that runs in SSMS, however, when I click [Run], the query closes but the alert never goes away.  I'm not able to make this query run since the permission thing never goes away. 

 

The CSV params are insterted like this: 

Declare @CompanyEntityIdList varchar(MAX) = '" & Text.Combine(CompanyEntityId_Text, ",") & "'   -- FAILS

 

This works (I'm able to update the query permission):

@CompanyEntityIdList varchar(MAX) = '"& Text.Combine({"1","2","18011"}, ",") &"'

 

 

There's something about referencing the Power BI List (CompanyEntityId_Text) that causes the query to not be able have permissions granted. 

Status: Needs Info
Comments
v-jiascu-msft
Employee

Hi @Anonymous,

 

How can I reproduce it? 

I tested it this way. It works fine.

declare @CompanyEntityIdList varchar(MAX) = '"& Text.Combine({"1","2","18011"}, ",") &"';
select @CompanyEntityIdList + month from st2;

Did you see these threads?

1. https://community.powerbi.com/t5/Desktop/Why-is-DECLARE-not-supported-Error/td-p/40983

2. https://community.powerbi.com/t5/Desktop/Declare-parameters-for-SQL-query-in-Power-BI/td-p/195620.

 

Best Regards,

Dale

Vicky_Song
Impactful Individual
Status changed to: Needs Info