R programming language resources › Forums › Data manipulation › Adding an object into a sqlQuery
Tagged: programming R
- This topic has 0 replies, 1 voice, and was last updated 10 years, 7 months ago by
n3w2R.
- AuthorPosts
- September 30, 2014 at 4:07 pm #1066
n3w2R
MemberHi I am trying to a add an object into a sql query but I am getting the following error Error in if (errors) return(odbcGetErrMsg(channel)) else return(invisible(stat)) :
argument is not interpretable as logicalI cant work out what needs changing, basically my object is the sql database name. If I manually type the database name in my code works but because this changes on a weekly basis I have created an object to always give the correct database name. my code is belowStartCode(Server = “tst01″,DB=dataBase,WH=FALSE)
POLICYLIST <- sqlQuery(channel1,”
SELECT DISTINCT [POLICYNUM],(GETDATE()-3) RUN_DATE
FROM “,dataBase,”.[dbo].[policy] “)
POLICYLIST$RUN_DATE <- as.character(POLICYLIST$RUN_DATE)
StartCode(Server = “tst02″,DB=”NEW”,WH=FALSE)
sqlQuery(channel1,”drop table PolDt”)
sqlSave (channel1, POLICYLIST, “PolDt”)Please let me know if I have not been clear, any help/advise would be very grateful.
Thanks - AuthorPosts
- You must be logged in to reply to this topic.