all things Sitecore related

Sitecore Rocks – Executing multiple queries at once in Query Analyzer

Hi there,

A really really small blogpost, but might come handy some day, when you need it.

Today I needed to ask a ‘fairly simple’ thing about Sitecore Rocks Query Analyzer, that I wasn’t aware of, to Jakob Christensen, developer and architect of Sitecore Rocks.

He responded with an answer that he thought might be the answer, but wasn’t sure of either.

The question was: Any idea how to execute multiple Sitecore queries in query analyzer in Rocks?

sitecorerocks-queryanalyzer

The answer is really simple, but I couldn’t find any info on it in the examples on the Sitecore Rocks – Query Analyzer examples page: http://vsplugins.sitecore.net/Sitecore-Query-Analyzer-Samples.ashx

So when we have multiple queries and we want to execute them at once, we end up with an error.

select * from /sitecore/content/*
select * from /sitecore/templates/*

End of script expected at position ……

We can of course execute them at once by selecting them line for line and then clicking the Execute button in Query Analyzer. But I don’t want to fire multiple times on the execute button, so imagine that you’ve got a bunch of delete scripts, that will delete test data from a lot of locations, than instead of writing a custom script, just with query analyzer the same thing could be achieved. Anyway, this blog post is not about what situations you’re going to use it in, the solution is what is of importance.

Just append a semicolon ( ; ) to the statements, so our queries will look like this:

select * from /sitecore/content/*;
select * from /sitecore/templates/*;

when you now execute multiple queries at once in Sitecore Rocks Query Analyzer the executing goes well!

Hope somebody finds this little blogpost on the to be appended semicolon usefull!

Happy Sitecore trails!

Robbert

About the Author

About the Author: I'm a Freelance and passionate Sitecore Developer living in The Netherlands. Running my own company Kayee Internet & Software Oplossingen. I am specialized since 2008 in Sitecore and Umbraco implementations. Sitecore MVP since 2011. Founder and member of the Dutch Sitecore User Group. You can follow me on twitter: @kayeeNL. My website: http://www.kayee.nl .

Subscribe

If you enjoyed this article, subscribe now to receive more just like it.

Post a Comment

Your email address will not be published. Required fields are marked *

Top