Forum Discussion
Markzolotoy
5 years agoImpactful Individual
Error loading data
I have the following SQL in my query: declare @AlarmSummaryAlramCount table (summary_description nvarchar(20), summary_cnt int);
DECLARE @reportData TABLE(
reportID int, userSID varchar(max), ...
ToddChitt
5 years agoSuper User
Does this EXACT text work in SSMS?
Not sure you can do complex statements, stuff with declared variables, etc. Maybe you should wrap this into a stored procedure in the database then run that proc from Power BI.
Markzolotoy
5 years agoImpactful Individual
It works perfectly in SSMS.
- ToddChitt5 years agoSuper User
Is the entire statement wrapped in double quotes? Is it its own Query?
I do this sometimes, create a query with something like:
" SELECT ... FROM...WHERE... "
Then have a second query with M code like this:
let
Source = Sql.Database(ServerName, DatabaseName, [Query=#"sql_text"])
in
SourceIs that what you are doing here?