Cross-site queries on SEDE fail with "The EXECUTE permission was denied"

by Ilmari Karonen   Last Updated October 10, 2019 15:24 PM

I just noticed that any cross-site queries using dynamically generated SQL on the Stack Exchange Data Explorer (SEDE) now fail with the error message:

The EXECUTE permission was denied on the object 'sp_executesql', database 'mssqlsystemresource', schema 'sys'.

Typically this message is repeated many times as the code tries to loop over all SE sites:


I don't know exactly when this stopped working, but it must've been sometime within the last two months, as it was still working fine in mid-August.

I'm not sure if this technically constitutes a bug, since AFAIK this feature was never explicitly supported. However, the change did break a number of useful queries, such as this one for making a backup of all your posts on the SE network and this one that lists duplicates of deleted questions and uses the cross-site query feature to exclude migrated questions. (I've edited the latter query to temporarily disable the cross-site part, so that it at least mostly works.)

So my questions are:

  1. Can this feature please be re-enabled (e.g.) by adding the necessary permissions?
  2. If not, is there any work-around?

Related Questions

Updated February 17, 2016 01:10 AM

Updated August 10, 2017 12:24 PM

Updated October 19, 2017 19:24 PM

Updated May 21, 2018 22:24 PM