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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Keithr197
Regular Visitor

SQL Query in Power Query

Hi All

2 Questions:

1. I have an SQL query that starts with DROP Table when importing it via Power Query i get an error due to the drop table. 

2. I have 3 SQL queries that im importing via Power query, on a weekly basis i would usually update the week (ie, 01,02,03)  in the 3 queries. Is there a way in Power query that i can do this?

Thanks for the feedback in advance

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Keithr197 

 

For question 1, it is not suggested to have DROP Table statement in the SQL query. When we import data via Power Query, we are usually to select data from the database rather than drop a table there. Please remove the DROP Table statement from the SQL query. 

 

For question 2, you can use the query parameter. Here is a video tutorial for your reference: Pass parameter to SQL Queries statement using Power BI | Microsoft Learn

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Keithr197 

 

For question 1, it is not suggested to have DROP Table statement in the SQL query. When we import data via Power Query, we are usually to select data from the database rather than drop a table there. Please remove the DROP Table statement from the SQL query. 

 

For question 2, you can use the query parameter. Here is a video tutorial for your reference: Pass parameter to SQL Queries statement using Power BI | Microsoft Learn

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!

djurecicK2
Super User
Super User

Hi @Keithr197 ,

 You could look at using parameters as an option for #2

https://learn.microsoft.com/en-us/power-query/power-query-query-parameters

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors