How to stop a running query?

前端 未结 4 1752
被撕碎了的回忆
被撕碎了的回忆 2021-02-18 14:08

I use RODBC to send queries to an SQL-Server. Sometimes they take too much time to run, so I need to cancel them.

Clicking the red \"stop\" button in RStudio yields this

4条回答
  •  醉话见心
    2021-02-18 14:35

    try to set your connection prior to query:

    sql = odbcConnect('Database name')

    Then use same line to run your query:

    mydf <- sqlQuery(sql, " myquery ")

    Note: The running time is dependant on both database and R server but setting up the connection this way should resolve termination problem.

提交回复
热议问题