Recently, I was helping to answer a question about how to edit a query within the TechNet forums. There happened to be several screenshots posted of the query, but they were almost impossible to read. In this format, it also made testing the query difficult because you couldn’t simply cut and paste it.
Instead of screenshots, why not use the code feature when posting to the TechNet forums?
This blog post will show you how to use the code feature and it will also give you extra tips about how to help others read and use your query.
First Tip: Use one of the query formatting tools that are listed within my Query Formatting Tools blog post in order to make your query easy to read and understand. It goes without saying that if the query is hard to read, you will not get as many people to help you.
Now that you have a nicely formatted query, add it to your TechNet forum post. In the onscreen edition, when you are ready to insert your code block, click on the Insert Code Block icon (red arrow).
In the new Insert Code Block window, paste your formatted query. Then select Sql as the language in the drop down menu. Finally click on the Insert button.
Second Tip: Don’t worry about how it looks here.
Complete the rest of the post as you normally would and then click on Submit.
Third Tip: Once posted, you can see that the code block is easy to read, is separated from the forum message and has scroll bars, so that word wrapping doesn’t become an issue. This last item is particularly useful when trying to read the code.
If you have any questions about this or any other post, please let me know @GarthMJ.