I have a very simple SQL query that I would like to see in R.
The problem is that I need to be able to reference #table:
select RAND(1) as random into #test select * from #test
Is this possible, or do I need to create persistent tables or find another job?
I am currently doing this through a RODBC script that allows me to choose which SQL file to run:
require(RODBC) sql.filename <- choose.files('T:\\*.*') sqlconn <- odbcDriverConnect("driver={SQL Server};Server=SERVER_NAME;Trusted_Connection=True;") file.content <- readLines(sql.filename) output <- sqlQuery(sqlconn, paste(file.content[file.content!='--'],collapse=' ')) closeAllConnections()
Do you have any tips on how I can use #tables in my SQL scripts in R?
Thanks in advance!
user1963962
source share