Dear all,
I need to test for the existence of an index on a table. This cannot be done
with sqlPrimaryKeys as it is not a primary key. Therefore I select directly
from the systemtable of SQL-Server 2000 named sysindexes. This works well with
RODBC Version 1.2-5 but not with version 1.3-0.
Here is the code of the test example:
sink(file = "proto.txt", append = FALSE, type = "output",split = TRUE)
library(RODBC)
sessionInfo()
str <- "DRIVER=SQL
Server;SERVER=NN;APP=Test;DATABASE=Northwind;Trusted_Connection=YES"
sql.ch <- odbcDriverConnect(connection = str, case = "nochange",
believeNRows = TRUE)
sql <- "Select top 10 * From sysindexes"
cat(date(),"Start query\n")
rc <- sqlQuery(sql.ch, sql)
print(rc)
odbcCloseAll()
sink()
This is the output of the correct working version 1.2-5:
R version 2.8.1 (2008-12-22)
i386-pc-mingw32
locale:
LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RODBC_1.2-5
Tue Sep 08 09:54:37 2009 Start query
id status first indid root minlen keycnt groupid
dpages
1 1 18 080000000100 1 0B0000000100 42 1 1
3
2 1 2 3A0100000100 2 3A0100000100 7 3 1
1
... output shortened
This is the output for version 1.3-0, which crashes after the call to sqlQuery:
R version 2.9.2 (2009-08-24)
i386-pc-mingw32
locale:
LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RODBC_1.3-0
Tue Sep 08 09:52:37 2009 Start query
CRASH!
By the way: 'Select top 1 * From sysindexes' does not crash!
I really do'nt know why RODBC crashes. Any hints to solve this problem with
version 1.3-0 are welcome.
Thanks in advance
Michael Irskens
German Public Employment Services
Operations Research
Nuremberg, Germany
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.