If I just select the required results in the grid, using the built-in Copy with Headers… and then paste it directly into a document, I no longer have a nicely-formatted tabular output. Several times a week, I need to include query results in emails or report documents. ) AS Rows ( RowId, GuidValue, StringValue ) To demonstrate how I use each of these features, typically, I will use the following simple query: Two of them, Copy as IN clause and Script as INSERT, will ‘refactor’ query results into code that you can use in another query, and the third, Open in Excel will export the results directly to Excel, for reporting. If I need to use the query results to populate another table, or to search from matching rows in another table, it always entails 10-15 minutes messing around with formatting the output, especially commas and quotation marks, to get a working query.įortunately, hidden within SQL Prompt’s right-click context menu, when you’re working in the SSMS grid format results pane, are some features that can help. I’ve always found this an awkward and time-consuming process.įor example, if I want to include the query results in a document or email, it will inevitably involve a lot of manual tweaking to get the results into a readable format. However, over my 20 plus years as a SQL programmer, I’ve often needed to take these results and use them elsewhere, like in a document or as input to other queries. Within SSMS, when executing a query, we can view the query results in a grid, or tabular, format ( Ctrl-D), as plain text ( Ctrl-T), or we can write them to a plain-text reporting (. This is a guest post from Louis Davidson.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |