SQL Query Output vs Test Query

SQL Query Output vs Test Query

  

Hi,

I am currently doing an Advanced Query which outputs to no rows but when I tried to run it on the SQL Management Studio, I received an output.

Below is the query:

SELECT {AccountingEntries_MT}.[AccountTitle]
, {InvoiceAccountingEntries}.[NormalBalance]
, sum({InvoiceAccountingEntries}.[Amount])
from {InvoiceAccountingEntries}
left outer join {AccountingEntries_MT} on 
{InvoiceAccountingEntries}.[AccountingEntires_MTID] = {AccountingEntries_MT}.[Id]
where convert(varchar(300),{InvoiceAccountingEntries}.[InvoiceHeaderID]) in (@InvHeaders)
group by {AccountingEntries_MT}.[AccountTitle], 
{InvoiceAccountingEntries}.[NormalBalance]
order by {InvoiceAccountingEntries}.[NormalBalance] desc

@InvHeader is a Text which can contain a series of integers (1000,1002,1003).

What can be the cause of this?

Are you passing test values in Service Studio to @InvHeaders parameter?

Hi,

It seems to be wrong to convert the InvoiceHeaderId to a varchar/Text, since @InvHeaders contains a list of integers. The fact that that variable is a Text doesn't matter. With Expand Inline set to True, it becomes a part of the query, and the value is treated as a list of integers.

Maybe this already solves the issue?