cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jonoling
Frequent Visitor

SQL Tables importing without associated data types

Hi,

 

I have a fact table that I'm connecting to in SQL. When reviewing the INFORMATION_SCHEMA.COLUMNS query in SSMS for the table it shows the [order_date] field as being stored as a datetime data type which is correct:

jonoling_0-1616619798895.png

 

However when importing this table into PBI Desktop all the datatypes are changed to Text in transit:

2021-03-25_10-05-09.png

 

The only steps in the query are:

let
Source = Sql.Database(sqlserver, db)
Table = Source{[Schema="dbo",Item=tablename]}[Data]
in
Table
 

I can convert the data types manually in Power Query but this prevents incremental refresh if we have to download the entire dataset, change types and then filter.

 

Have had a search around but couldn't find any reasons as to why this would occur. Would welcome ideas as to why this is happening, and how to resolve.

 

Thanks Power BI Community!

 

1 ACCEPTED SOLUTION

None, it's the out of the box SQL Server connector from Power Query. The only inputs it's taking is the SQL string and DB, then navigating to the table in question. 

 

let
Source = Sql.Database(sqlserver, db)
Table = Source{[Schema="dbo",Item=tablename]}[Data]
in
Table

 Agree, it doesn't seem to be a widespread issue, this is the first time I've come across an issue like this. Just tested with a sandbox WorldWideImporters DB and the native query generated brings through datatypes fine. 

jonoling_0-1617062684862.png

 

Odd!

View solution in original post

5 REPLIES 5
lbendlin
Super User III
Super User III

Anything suspicious on the Fiddler or Power Query Diagnostics?

lbendlin
Super User III
Super User III

which options parameters did you apply to your connector?  If this were a widespread problem we'd have heard about it by now.

None, it's the out of the box SQL Server connector from Power Query. The only inputs it's taking is the SQL string and DB, then navigating to the table in question. 

 

let
Source = Sql.Database(sqlserver, db)
Table = Source{[Schema="dbo",Item=tablename]}[Data]
in
Table

 Agree, it doesn't seem to be a widespread issue, this is the first time I've come across an issue like this. Just tested with a sandbox WorldWideImporters DB and the native query generated brings through datatypes fine. 

jonoling_0-1617062684862.png

 

Odd!

View solution in original post

lbendlin
Super User III
Super User III

Run a fiddler trace and also check the query logs on your SQL server.  Maybe something is blocking the meta data calls?

 

 

Looks like the issue is with the Power BI SQL Connector itself. Looking at the native query being sent, all fields are being converted to text data types:

jonoling_1-1617058924760.png

Writing a custom SQL statement to select the data seems to bring across the right datatypes. I haven't come across documentation on why this occurs and how to turn it off yet though.

 

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors