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

Select columnsnames with "." in the name

Hi all,

 

I have a problem as I want to collect only a few columns from a table. But the column name in the database have a "." in it, which gives an error: extraneous input '.0' for example. In the column alrmbitsfeeddrive.0.

 

Here my query, how can I make it so power bi sees it as a column name. 

 

= Odbc.Query("dsn=" & ConnectionName & "", "
SELECT timestamp,

runningshours,

alrmbitsfeeddrive.0, 
alrmbitsfeeddrive.1,
alrmbitsfeeddrive.3,
FROM " & TableName & "
WHERE serial_number = XXXX
ORDER BY timestamp ASC
")

 

Hope you can help me

 

 

2 REPLIES 2
Highlighted
Stachu Super Contributor
Super Contributor

Re: Select columnsnames with "." in the name

Depending  on the version of the SQL you are running, wrapping the column names in [ ] , ' '  or `` may work


You could also connect to the database and create this query with the UI and query folding (if your source is supported)
https://devinknightsql.com/2016/07/03/power-bi-checking-query-folding-with-view-native-query/

and the SQL will be generated as the Native Query

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Mans010 Frequent Visitor
Frequent Visitor

Re: Select columnsnames with "." in the name

Thanks for your help, but I have used [] and '' and "". All give the same error.

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Top Kudoed Authors
Users Online
Currently online: 6 members 1,741 guests
Please welcome our newest community members: