Im creating an excelfile with data from a SQL server. I have no problem establishing a connection but when I enter the following SQL statement the part after Where seemes to be ignored.
Select *
FROM dbo.IMP_ELEMENT
Where dbo.IMP_ELEMENT.CHANGED_DATE <'2018-01-01';
This causes the excelfile to retrieve all the rows in the database which makes it very slow.
I've tried to rename dbo to the actual databasename and tried to use VBA as well but neither worked out particarly well.
This is the used code in the PowerQuery Editor:
= Odbc.Query("dsn=IMPACT", "Select * FROM dbo.IMP_ELEMENT
Where dbo.IMP_ELEMENT.CHANGED_DATE <'2018-01-01'")
I expect The Query to only generate rows newer than 2018-01-01. And I don't want recieve all data and then filter it in Excel as that is very slow with a large database. Anyone got any idea?
.CHANGED_DATE
is a date/datetime column? – Mistella