sql - Execute multiple statements separated by semicolons in RODBC -
i have complex sql query trying run through rodbc involves defining variables. simplified version looks this:
declare @varx char = 'x'; select * table type = @varx; running code works fine. fails:
library(rodbc) q <- "declare @varx char = 'x';\nselect * table type = @varx;" sqlquery(ch, q) # returns character(0) i have found through experimentation first statement before semicolon executed, rest not. there no error--it seems after semicolon ignored. there way execute full query?
i'm using sql server way.
note: asked question before , marked duplicate of this question, asking different things. in question execute script contains multiple statements, , in other author trying execute single statement.
Comments
Post a Comment