Adding an object into a sqlQuery

R programming language resources Forums Data manipulation Adding an object into a sqlQuery

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by  n3w2R 5 years, 3 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1066

    n3w2R
    Member

    Hi 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 logical
    I 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 below

    StartCode(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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.