Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi, I am trying to execute a sql query and receiving the syntax: (SQL is created a temporary table.)
"microsoft sql incorrect syntax near the keyword 'into'. incorrect syntax near ')'. power bi
Any help would be appreciated.
tks/
Solved! Go to Solution.
Figured it out. Thank you both for your help.
I was trying to do a 'Direct Query' vs 'Import Query'.
Hope you are safe and well... thanks again!😊
I am unsure if my remark will be read but I wanted to discover the most efficient way to pull data that uses a SQL Server QUERY to pull data from a Temporary table in Power Bi and use incremental refresh too as the report will be updated daily. I suppsoe going the stored procedure route is the best? Any advice is certainly welcome as this is a very large and unruly dataset!
@Anonymous
Seems like you have a syntax error in your SQL code, please re-check.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
I agree, but the code works in SSMS, but won't pull in PBI.
part of code:
SELECT DISTINCT ll.LoadId
INTO #LoadFilter
[code]
DROP TABLE #LoadFilter
PBI does not like the 'INTO' . Not a SQL expert nor PBI expert, but know a little to understand the error.
@Anonymous
It seems that PowerBI cannot translate the SQL Query properly.
Instead of temp table why dont you use a CTE (in memory table) in your sql query??
Another option is to create a store procedure, add the sql query code there and then call the procedure from PowerBI. Like:
DECLARE @sqlcode varchar(1000)
SET @sqlcode= 'dbo.queryproc
EXEC (@sqlcode)
Figured it out. Thank you both for your help.
I was trying to do a 'Direct Query' vs 'Import Query'.
Hope you are safe and well... thanks again!😊
Hi @Anonymous ,
Is there anything else need help about this thread? If no, could you please mark your post as Answered? It will help the others in the community find this solution easily if they face the same problem with you. Thank you.
Otherwise, you can refer the following links to get it.
Connect using advanced options
Working with SQL Server data in Power BI Desktop
Best Regards
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
86 | |
85 | |
66 | |
49 |
User | Count |
---|---|
140 | |
113 | |
104 | |
64 | |
60 |