Microsoft SQL and multiple items

Hello again!

Sorry for bothering once again today. I have a pertty straight forward question/problem: Is the Microsoft SQL node not capable of being called multiple times?

I have this very simple Function that generates 2 items. But the Microsoft SQL only returns a result for the first item. It is not called the second time. Is this my fault or is the node having some issue?

Regards Sebastian

Ah yes you are sadly correct. It looks like it got implemented wrongly and it executes only once. We have to fix that in a future version of the node (changing it now could break the workflows of people). So what you would have to do for now is to use the SplitInBatches node set to 1 and then iterate with it over the items.

1 Like

Can I merge the Batches back together?

Yes, that is possible. You can find an example here:

thanks Jan once again.

The noItemsLeft is a neat trick! But it is a it tricky to find (https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/SplitInBatches.node.ts#L85). This should be added to the documentation (the `$node.context) or even be made obviously available in the node as an Output or something imho.

Thanks anyway for saving the day once again!

1 Like

Yes agree. We will add it to the documentation.

Hello, @jan
Do you known if that problem will be fixed soon ?

Hey @pr-elips,

Welcome to the community :tada:

It is not something I have seen on the immediate roadmap, It can be done with the split in batches node at the moment though so it can be worked around.

Thank you @Jon,

I have a problem with the work around too :wink:

The {{$node[“SplitInBatches”].context[“noItemsLeft”]}} returns false on the last item.
So it doesn’t processed.

Hey @pr-elips,

That is worrying I use the Split In Batches node in a few of my workflows so it not working would be a big problem.

Can you open a new thread and include your workflow and the version of n8n you are using so that we are not bumping a 2 year old thread :slight_smile:

Good day,
will this issue be fixed or is this now the standard behaviour for the Microsoft SQL node?

Hey @feelgood-interface,

This is something that may be fixed in the future but it would be a breaking change, For now using split in batches is the recommended solution.