Best answer

How to retrieve all rows matching a specific parameter in a MS SQL database column with Zapier?



Show first post

79 replies

Userlevel 1
Badge

I’ve figured out quite a simple workaround for this.

Firstly you need to run a Find Row via Custom Query in SQL Server statement that selects the key of each of the elements in your list. So if you imagine your table called FOOD is like this:

 

and you want to loop through all the elements that are type ‘Hot’

Run a SQL Select that looks like this:

select replace((stuff((select ',' + str(id) FROM Food where type = ‘Hot’ FOR XML PATH('')),1,1,'')), ' ', '') as ID

That will return a single element with the value ‘2,3’

You then use Create a Loop from Text that loops through each id in the results from above in turn with the sub loop elements able to reference each Key (Id) value in turn so you can update, or read or whatever using other SQL functions.

A limitation to this approach is Loops don't work in sub-zaps and loop have to be at the end of a zap. So it works if you have a discrete process to run on multiple records, but not if you want to process multiple records and then continue on to do something else within the same zap.

Hi, this is essential to have not just for MYSQL but also Postgres. Please add my vote as well.

Userlevel 6
Badge +3

Hi @Jim Case 

 

I’ve added your vote for this feature request, we’ll notify you via email once available. Thanks!

One more vote from me

Please add my vote for this as well

Please add me too. Really need this feature.

Userlevel 7
Badge +11

Sorry to hear Mark B’s suggestion won’t work for your Zaps @MortEdBrad. I can totally understand how disappointing it must be to wait this long for this feature to be added. And I really wish I was writing back with better news but we can't commit to any timeline or give any guarantee as to when this feature request would be implemented. It appears our Support team had previously added your vote though which will allow us to notify you via email once it’s added.


@asg3 - Ah, yes if you’re specifically wanting to loop through items in a Sub-Zap and then send that to another Zap it wouldn’t work as you can’t add a loop action step in before a Return from Sub-Zap action step. If we come across any alternative workarounds we’ll be sure to share them here. Sorry to not have a more immediate solution on this right now.  

Userlevel 7
Badge +11

Hey @neutron_star

I’ve added your vote as well. We’ll be in touch by email with any updates! :)

Userlevel 6
Badge +3

Hi @BackwoodsMag 

I’ve added your vote for this feature request, and we’ll  notify you via email once an update is readily available. Thanks.

Userlevel 7
Badge +8

@raizz you have been added!

Userlevel 7
Badge +12

Prioritization is largely dependent on the number of customers affected. By adding your vote, I was able to add some weight to the issue! 

 

I'm sorry I don't have a more definitive answer here, we’ll send you an email if we have any updates. 
 

Userlevel 7
Badge +11

Hi @chris12312124 and @stir you’ve been as interested users as well :)

Userlevel 7
Badge +8

@SandsTabs you have been added to this request!

Please add me to the list of requestors as well.  Any idea how many requests it takes to get a feature added?  I’m a potential customer working through my use case and without this feature, I don’t see moving forward.  We are querying a MySQL database and attempting to write new/updated records to rows of a SmartSheet.

given this request was started years ago, it probably isnt going to happen, but in case please add my vote for it!

Userlevel 7
Badge +11

Thank you so much for reaching out here, @Mark B! 😁

We really appreciate you sharing this workaround. I’m sure there are lots of folks in Community that will use it for their Zaps! 🙌

Userlevel 7
Badge +11

Hi @isaiah_p 👋

I’ve just checked again and it’s still not been added yet. I’ve added your vote which helps to bump up it’s priority but I can’t give an estimate on when you can expect it to become available. 

Thanks for everyone’s continued patience here. We’ll keep this thread updated with and additional updates or workarounds we come across in the meantime!

Userlevel 1
Badge

One more request for this feature.

Userlevel 1
Badge +1

Hi there @The Agents I have an idea on how this can be "hacked” you could create a view using the FOR JSON

please read both articles I think you could find the trick.

https://docs.microsoft.com/en-us/sql/relational-databases/json/format-query-results-as-json-with-for-json-sql-server?view=sql-server-ver15


https://www.mssqltips.com/sqlservertip/5348/advanced-techniques-to-transform-relational-data-to-json-in-sql-server-2016/

then parse the JSON you get from Row/Find
 

Get my vote in as well please!

Userlevel 6
Badge +3

Hi @alkakandilli 

I’ve added your vote for this feature request, we’ll notify you via email once available. Thanks!

I’m interested in this feature too, please add me and also is it possible to suggest workarounds in the meantime?

 

e.g I have a VoIP product, and I want to send Top 10 users to our Slack channel. Currently it can only return the Top 1 user from the MySQL custom query...

And add me to this request as well. To put it bluntly; we can’t  use Zapier for our purposes without this feature.

 

Please add me as well to this request!

please add me too. thanks!

Reply