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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

SQL STATEMENT ONLY RETURNS THE COLUMN NAMES

Hi All,

I'm having an issue with a SQL statement, it will only return the column names and no data, but I have ran the query in SAP and the data is there . Not sure why the results are not coming up.

Here it's the query:

Select * FROM database.table WHERE 'Project' in ('xxx1',
'xx2',
'xx3')

And the result that I'm getting it's all the column names of the table with no data in the rows. Does anyone know why that is happening?


Appreciate your help!
Thanks,
Mariana 

1 ACCEPTED SOLUTION

Hi @Anonymous thanks again...yes it's similar indeed, but with this other database it worked with the "":


Select * FROM "database"."table" WHERE "Project" IN ('xxx1',
'xx2',
'xx3'
)


I will just try all the posibilities next time I have the same issue...thanks

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

I think that your single quotes around Project are the issue:

https://www.w3schools.com/Sql/sql_in.asp

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Select * FROM database.table WHERE Project in ('xxx1',
'xx2',
'xx3')

It is the same as you put there a minutes ago.. You can't put '' in column names in SQL querys.

Hi @Anonymous thanks again...yes it's similar indeed, but with this other database it worked with the "":


Select * FROM "database"."table" WHERE "Project" IN ('xxx1',
'xx2',
'xx3'
)


I will just try all the posibilities next time I have the same issue...thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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