0

I am trying to use dbplyr to pull data from SQL DB using the code below by select columns and filter rows.

df <- tbl(con, in_schema("adm", "tablename")) %>%
   select(col1, col2, col3) %>%
   filter(col1 >= min_date) %>%
   collect()

But I have the following error message. Does anyone experience this issue?

Error: <SQL> 'SELECT *
FROM (SELECT TOP 100 PERCENT "col1", "col2", "col3"
FROM adm.tablename) "dbplyr_004"
WHERE ("col1" >= '2018-10-11')'
  nanodbc/nanodbc.cpp:1587: 42000: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Parse error at line: 2, column: 22: Incorrect syntax near 'PERCENT'.
Simon.S.A.
  • 6,240
  • 7
  • 22
  • 41
Gavin
  • 1,411
  • 5
  • 18
  • 31
  • Hi, I never succeeded filtering a variable following the select of that same variable. – Gray Oct 29 '19 at 02:34

1 Answers1

0

Here is the issue that was discussing https://github.com/tidyverse/dbplyr/issues/337

Gavin
  • 1,411
  • 5
  • 18
  • 31