Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
I have data stored in SQL Server.
When I run a query with specific filters and export the result to a CSV file, the exported file contains only data rows without column names (headers).
Because of this:
When I use Get Data → CSV in Power BI / Microsoft Fabric,
The dataset is loaded without column names, and the first row is treated as data.
Expected Behavior
The exported CSV file should include column headers, so that Power BI / Fabric can correctly recognize the column names.
Actual Behavior
CSV file contains data only
No column headers
Power BI / Fabric does not detect column names
Environment
SQL Server
SQL Server Management Studio (SSMS)
Power BI / Microsoft Fabric
>>>>>>>>>>>>>>>>>>>
What is the recommended way in Microsoft Fabric to:
Export query results from SQL Server to CSV with column headers, or
Ingest SQL Server query results into Fabric / Power BI without losing column names?
Solved! Go to Solution.
@Rufyda This is not a Power BI / Fabric issue. It comes from how the CSV is being generated from SQL Server.
1. Do not export to CSV manually
Best practice is to connect Fabric / Power BI directly to SQL Server:
Use SQL Server connector
Use a view or native SQL query
This preserves column names and data types automatically.
2. If you must generate a CSV, use a tool that includes headers
SSMS “Save Results As CSV” does not reliably include headers.
Better options:
bcp with -h option
sqlcmd with headers enabled
SSIS or Fabric Data Factory pipeline
Example (sqlcmd):
sqlcmd -S ServerName -d DatabaseName -Q "SELECT ..." -s "," -W -o output.csv
3. Use Fabric Data Factory / Pipelines
Recommended Fabric-native solution:
Source: SQL Server
Sink: Lakehouse / Files (CSV)
Enable “First row as header”
This guarantees headers and avoids CSV issues entirely.
4. Power BI workaround (not ideal)
In Power Query:
Manually promote first row to headers
This only works if the first row actually contains column names.
Thank you to everyone for the helpful suggestions 🙏
I wanted to share the final resolution in case someone else faces the same issue.
The problem was not related to Power BI or Microsoft Fabric, but rather to SSMS settings.
In SQL Server Management Studio (SSMS), when exporting query results to CSV:
Go to Tools → Options
Then Query Results → SQL Server → Results to Grid / Results to Text
Enable “Include column headers when copying or saving the results”
After enabling this option, the exported CSV file included the column headers correctly, and Power BI / Fabric recognized the columns without any issues.
Hope this helps someone facing the same problem 👍
Thank you to everyone for the helpful suggestions 🙏
I wanted to share the final resolution in case someone else faces the same issue.
The problem was not related to Power BI or Microsoft Fabric, but rather to SSMS settings.
In SQL Server Management Studio (SSMS), when exporting query results to CSV:
Go to Tools → Options
Then Query Results → SQL Server → Results to Grid / Results to Text
Enable “Include column headers when copying or saving the results”
After enabling this option, the exported CSV file included the column headers correctly, and Power BI / Fabric recognized the columns without any issues.
Hope this helps someone facing the same problem 👍
Hi @Rufyda
You can connect directly to SQL Server connector in Power BI / Fabric by writing your query in Advanced options. Column names will populate.
Also, using Fabric Dataflow Gen2 or Pipeline with SQL Server source and using either a query or table sinking to lakehouse.
@Rufyda This is not a Power BI / Fabric issue. It comes from how the CSV is being generated from SQL Server.
1. Do not export to CSV manually
Best practice is to connect Fabric / Power BI directly to SQL Server:
Use SQL Server connector
Use a view or native SQL query
This preserves column names and data types automatically.
2. If you must generate a CSV, use a tool that includes headers
SSMS “Save Results As CSV” does not reliably include headers.
Better options:
bcp with -h option
sqlcmd with headers enabled
SSIS or Fabric Data Factory pipeline
Example (sqlcmd):
sqlcmd -S ServerName -d DatabaseName -Q "SELECT ..." -s "," -W -o output.csv
3. Use Fabric Data Factory / Pipelines
Recommended Fabric-native solution:
Source: SQL Server
Sink: Lakehouse / Files (CSV)
Enable “First row as header”
This guarantees headers and avoids CSV issues entirely.
4. Power BI workaround (not ideal)
In Power Query:
Manually promote first row to headers
This only works if the first row actually contains column names.
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 61 | |
| 49 | |
| 30 | |
| 25 | |
| 23 |
| User | Count |
|---|---|
| 128 | |
| 104 | |
| 56 | |
| 39 | |
| 31 |