Invalid column name
Question

I am getting invalid column name in outsystems. This column does exist in external DB

Error executing query. Error in advanced query GetBList in GetBList in Core (SELECT         @TargetColumn AS Target,      CASE WHEN SUM(T.[avail_wkg_hrs]) = 0 THEN 0            ELSE CAST(ROUND(SUM(T.[Billable_Capped])/SUM(T.[avail_wkg_hrs]),4)*100 AS NUMERIC(18,1))      END AS [MD Actual],            99 as [MD Target],                   CASE WHEN SUM(T.[QD_Available_Days]) = 0 THEN 0            ELSE CAST(ROUND(SUM(T.[QTD_Billable_at_Capped])/SUM(T.[QD_Available_Days]),4)*100 AS NUMERIC(18,1))      END AS [QTD Actual],           T.[QD_Billable_Target] as [QD Target],    -- CASE WHEN AVG(T.[QD_Billable_Target]*100) = 0 THEN 0           -- ELSE CAST(ROUND(AVG(T.[QD_Billable_Target]),4)*100 AS NUMERIC(18,1))    -- END AS [QD Target],                 CASE WHEN SUM(T.[YD_Available_Days]) = 0 THEN 0            ELSE CAST(ROUND(SUM(T.[YD_Billable_at__Capped])/SUM(T.[YD_Available_Days]),4)*100 AS NUMERIC(18,1))                 END AS [YD Actual],            99 as [YD Target]     FROM    (    @AccessQuery    ) T    GROUP BY     @TargetColumn      ): Invalid column name 'QD_BILLABLE_TARGET'.

Hi Mackenzie,

The issue might be in the escaped parts in your query.

When using -- to escape part of your query, then this will work fine when you test the query. In runtime however, the query is executed in one line as. This way, the commented parts are not correctly recognized. If you instead use /* and */ to escape these parts, it will also work in runtime.

Does this solve you issue?

Regards,
Lennart


Let me remove that and update you

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.