Closed erikking closed 4 months ago
Hi @erikking
Can you provide some information about your environment ( os, driver, package:odbc
and package:DBI
version ).
With 1.5.0 from CRAN I can't replicate your issue - either that or I don't understand the problem.
> conn@info
...
$dbms.name
[1] "Microsoft SQL Server"
...
$drivername
[1] "libmsodbcsql-17.10.so.6.1"
...
> sessionInfo()
...
other attached packages:
[1] odbc_1.5.0
...
loaded via a namespace (and not attached):
...
[5] DBI_1.2.2
> dbGetQuery(conn, "SELECT DB_NAME()")
1 deleteme
> DBI::dbListFields(conn, DBI::Id(schema="testschema", table = "tbl"))
[1] "CustomerUUID" "BranchNumber" "ArticleNumber" "ValidOn"
[5] "Comment"
@detule
Thanks for your reply. Please see my environment
> conn@info
$dbms.name
[1] "Microsoft SQL Server"
$drivername
[1] "SQLSRV32.DLL"
$odbc.version
[1] "03.80.0000"
$driver.version
[1] "10.00.17763"
$odbcdriver.version
[1] "03.52"
attr(,"class")
[1] "Microsoft SQL Server" "driver_info" "list"
sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.936 LC_CTYPE=English_United States.936 LC_MONETARY=English_United States.936
[4] LC_NUMERIC=C LC_TIME=English_United States.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] odbc_1.3.4 DBI_1.2.3
Hi:
BLUF: Can you test with a recent version of package:odbc
- I think the version you are using is ~ 2 years old.
I think part of the issue is that you are using a very up-to-date packge:DBI
, and somewhat dated package:odbc
. At some point, there was a change to the DBI::Id
API ( and I think your recent version includes this change ). I think it necessitates using a relatively recent package:odbc
that matches those changes.
Let me know what you find with an up-to-date package:odbc
. If still reproducible, we can dive further, though to be perfectly honest SQLSRV32.DLL
( legacy MS Access ODBC adapter?) is not a driver we normally support in the issue section.
Got it. I updated odbc to latest version 1.5.0, then it works for either of driver SQLSRV32.DLL
and msodbcsql18.dll
.
Thanks very much.
Run following code
return error
The
LIMIT 0
is not correct syntax for SQL Server, should beTOP 0
, looks like there is hard code in https://github.com/r-dbi/DBI/blob/905c0d1b238302de624ce742b06b10f528f2baac/R/03-DBIConnection.R#L34Hope it can be resolved, thanks in advance.