# Microsoft SQL return no data

**URL:** <https://community.n8n.io/t/microsoft-sql-return-no-data/134819>\
**Category:** Questions\
**Tags:** microsoft-sql\
**Created:** [June 18, 2025, 4:16pm UTC](https://community.n8n.io/t/microsoft-sql-return-no-data/134819 "2025-06-18T16:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Len](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/len/32/91895_2.png) [@Len](https://community.n8n.io/u/Len)\
**Post date:** [June 18, 2025, 4:16pm UTC](https://community.n8n.io/t/microsoft-sql-return-no-data/134819/1 "2025-06-18T16:16:49Z")

</div>

## Microsoft SQL return no data

When I try to run a SQL query and there’s no data to return, it returns an empty array. When I try to run an if and enter the data to validate, like {{Object.keys($items()[0].json).length === 0}}, it doesn’t work; the node closes.

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/4/6/461b83d3c394039936449b2831f285c5011afccc.png)

- **n8n version: 1.92.2**
- **Database :Microsoft SQL**
- **Running n8n via n8n cloud**

---

<div class="post-metadata">

**Author:** ![simon.lewis](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/simon.lewis/32/11925_2.png) [@simon.lewis](https://community.n8n.io/u/simon.lewis)\
**Post date:** [August 7, 2025, 4:34am UTC](https://community.n8n.io/t/microsoft-sql-return-no-data/134819/2 "2025-08-07T04:34:56Z")

</div>

Hi Len,

I would make sure the SQL Server node settings are set to **Always Output Data** and change the IF node to check if an item exists / does not exist in the JSON from the SQL node. For example:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/0/9/09496fbbc6cce7146b05aa6287e12545360624f3.png)

Any use ?

Rgds  
Simon

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [November 5, 2025, 4:35am UTC](https://community.n8n.io/t/microsoft-sql-return-no-data/134819/3 "2025-11-05T04:35:49Z")

</div>

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