Unable to execute SQL query due to syntax erros

Trying to run below Query from UiPath using Run Query Activity but lot of syntax errors are coming up. can someone please help to make it run from UiPath

Select
A.CMPGN_ID, A.OUTRCH_CMCTN_ID , TRIM(A.OPRTNTY_ID) “OPRTNTY_ID”, A.OPRTNTY_TSK_SEQ_NO, A.OUTRCH_CMPTN_DTM, A.OUTRCH_STS_CD ,
A.OUTRCH_STS_RSN_CD , CONCAT(CONCAT(TRIM(A.OUTRCH_STS_CD) , ‘-’),TRIM(A.OUTRCH_STS_RSN_CD) ),
A.MBR_REF_NO “MBR_NO”, A.GRP_NO ,CONCAT(CONCAT(TRIM(A.MBR_FRST_NME), ’ '),TRIM(A.MBR_LST_NME)) “MBR_NAME”,TRIM(B.MBR_DOB_DT) “MBR_DOB_DT”, B.MEME_CK
From IHMR.IHMR_OUTRCH_RSLT_T A
Join CBDW.CBDW_MBR B
On A.MBR_REF_NO = B.MBR_REF_NO
Where A.OUTRCH_CMPTN_DTM BETWEEN ‘2023-11-06’ AND ‘2023-11-07’
And A.OUTRCH_CMCTN_ID In (‘BCMD27_HCC’, ‘BCMD27_HCC_2ND’)
Order By A.CMPGN_ID ,A.OUTRCH_CMCTN_ID , A.GRP_NO, A.MBR_REF_NO

Hi @leela_madhiraju

Try this query:

Select
    A.CMPGN_ID,
    A.OUTRCH_CMCTN_ID,
    LTRIM(RTRIM(A.OPRTNTY_ID)) as OPRTNTY_ID,
    A.OPRTNTY_TSK_SEQ_NO,
    A.OUTRCH_CMPTN_DTM,
    A.OUTRCH_STS_CD,
    A.OUTRCH_STS_RSN_CD,
    CONCAT(CONCAT(LTRIM(RTRIM(A.OUTRCH_STS_CD)), '-'), LTRIM(RTRIM(A.OUTRCH_STS_RSN_CD))) as OUTRCH_STS_COMBINED,
    A.MBR_REF_NO as MBR_NO,
    A.GRP_NO,
    CONCAT(CONCAT(LTRIM(RTRIM(A.MBR_FRST_NME)), ' '), LTRIM(RTRIM(A.MBR_LST_NME))) as MBR_NAME,
    LTRIM(RTRIM(B.MBR_DOB_DT)) as MBR_DOB_DT,
    B.MEME_CK
From IHMR.IHMR_OUTRCH_RSLT_T A
Join CBDW.CBDW_MBR B
    On A.MBR_REF_NO = B.MBR_REF_NO
Where A.OUTRCH_CMPTN_DTM BETWEEN '2023-11-06' AND '2023-11-07'
    And A.OUTRCH_CMCTN_ID In ('BCMD27_HCC', 'BCMD27_HCC_2ND')
Order By A.CMPGN_ID, A.OUTRCH_CMCTN_ID, A.GRP_NO, A.MBR_REF_NO

Hope it helps!!

Thanks for the update. Replaced quotes with double quotes and it’s working fine from UiPath!

@leela_madhiraju

If you find solution for the query please mark it as solution to close the loop.

Happy Automation

Regards