Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem retrieving bigint value from SQL Server #35

Closed
hemip opened this issue Mar 8, 2017 · 1 comment
Closed

Problem retrieving bigint value from SQL Server #35

hemip opened this issue Mar 8, 2017 · 1 comment

Comments

@hemip
Copy link

hemip commented Mar 8, 2017

Problem retrieving bigint values

I was bit by a bug when testing out the odbc-package. I couldn't understand why my joins in dplyr didn't work as expected. After a while I found out that the type casting of bigint values didn't work as expected. Below is an example from our in house database, and a comparison with RSQLServer.

Database

SQL Server 2012

Non-reproducible example

library(odbc)
library(DBI)

# Using odbc
dbConnect(odbc::odbc(),"rt; UID=xxxxx; PWD=yyyyy") -> db
dbGetQuery(db,"USE RT; SELECT TOP 1 DelytaID, CAST(DelytaID AS char) AS DelytaCAST FROM dbo.vy_Delyteregister")
# Output
#     DelytaID  DelytaCAST
# 1 -603275544 81001103080                   

# Using RSQLServer
dbConnect(RSQLServer::SQLServer(),"RT") -> db
dbGetQuery(db,"USE RT; SELECT TOP 1 DelytaID, CAST(DelytaID AS char) AS DelytaCAST FROM dbo.vy_Delyteregister")
# Output
#      DelytaID  DelytaCAST
# 1 81001103080 81001103080 
Session Info
devtools::session_info()
#Session info #-------------------------------------------------------------------------------------------------
#setting  value                       
# version  R version 3.3.2 (2016-10-31)
# system   x86_64, darwin13.4.0        
# ui       RStudio (1.0.136)           
# language (EN)                        
# collate  sv_SE.UTF-8                 
# tz       Europe/Stockholm            
# date     2017-03-08    

# odbc         1.0.1      2017-02-17 Github (rstats-db/odbc@8abb2ab) 
# RSQLServer   0.2.099    2016-09-28 Github (imanuelcostigan/RSQLServer@0b16383)
@jimhester
Copy link
Contributor

Closing as a duplicate of #9, we will have true 64 bit support in the near future however!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants