Replace Value for Text

I've defined this variable

MES<- "2023-01"

Then I executed this code

# build sql query from TF
my_sql = "SELECT
A,
REF_PERIOD,
B,
C,
D,
E,
F,
G,
H,
I,
J,
K

FROM
BDIMDE.TF
WHERE
TF.REF_PERIOD=MESANALISE"

# send query to database engine
my_query <- dbSendQuery(con, my_sql)

# get query into a dataframe
df <- fetch(my_query)

But the dataframe df returned empty. TF.REF_PERIOD didn't assumed the value stored in MESANALISE even if instead of this

TF.REF_PERIOD=MESANALISE

I write this

TF.REF_PERIOD='MESANALISE'

Can you help me please?

dbSendQuery has a param argument for this; its documented in the dbSendQuery help file.
you can read it by sending the following to the R console

??dbSendQuery

the examples are towards the bottom of the help file.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.