To enable the the functionality of the 'View SQL Query' button, take these steps
Login directly to your Advanced Reporting server using the superuser account at http://<report_server_url>:8080/reportservice
Navigate to the Manage tab and click on Server Settings
In the Server Settings, click on Ad Hoc Settings
Under the Ad Hoc Settings, check on the 'Enable View Query in Ad Hoc Editor' box and use the Change button to have the change take effect
After applying the change, navigate back to your Ad Hoc Editor and you'll see that the 'View SQL Query' button in the Ad Hoc View Editor is now enabled.