I have a problem with RODBC statements that seems to be related to inserting
data into a table during an SQL batch (MS SQL Server). It started from a
stored procedure that didn't return data to R but I could boil it down to
the following simplified code snippets.

The first one does work:
sqlQuery(channel, "
        CREATE TABLE tab (x int)
        
        SELECT 'Test' AS Name
                
        INSERT INTO tab(x)
        VALUES(0)

        DROP TABLE tab
")

But running the SELECT statement after the INSERT statement does not:
sqlQuery(channel, "
        CREATE TABLE tab (x int)
        
        INSERT INTO tab(x)
        VALUES(0)

        SELECT 'Test' AS Name
                
        DROP TABLE tab
")

The table is not even used in the SELECT statement (of course, in my real
code it is).

I would appreciate any help

Daniel



--
View this message in context: 
http://r.789695.n4.nabble.com/RODBC-problem-inserting-into-tables-tp4310772p4310772.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org 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.

Reply via email to