r - RODBC query returns results from Windows, but not from Linux -
r - RODBC query returns results from Windows, but not from Linux -
i have r script fetches results sql query r studio on windows, not rapache on linux. 2 connection strings are:
channel = odbcdriverconnect('driver=freetds;server=server\\instance;database=db;uid=name;pwd=password') channel = odbcdriverconnect('driver={sql server};server=name\\instance;database=db;trusted_connection=true;')
i build sql , pass function:
get_sql_data <- function(query,as.is=true){ return(sqlquery(channel, query,as.is=as.is, errors=true)) }
i in sql profile , see batchstarting , batchcompleted event query rapache. re-create , past query ssdt , rows back. in rstudio can view() resulting dataframe. in rapache head this:
warning('head head') warning(head(results)) warning('head tail')
i following:
2: in eval(expr, envir, enclos) : head head 3: in eval(expr, envir, enclos) : 4: in eval(expr, envir, enclos) : head tail
what doing wrong? need utilize sqlgetresults()
or something?
so issue seemed declaring variables before statement so:
declare @foobar char(3) 'aaa'; select top (5) id, name, desc tbl code = @foobar;
changing to:
select top (5) id, name, desc tbl code = 'aaa';
caused result set appear on in linux windows. i'm going investigate why happens.
r rodbc rapache
Comments
Post a Comment