![easy markdown tables easy markdown tables](https://documentation.peelmicro.info/images/markdown/easy-markdown-with-vs-code/CommandPallete.png)
SET = + the procedure reads all the column names and get the data types, it starts constructing the table elements. INSERT INTO sp_executesql NVARCHAR(MAX)ĭECLARE VARCHAR(100) = (SELECT GETDATE())ĭECLARE VARCHAR(100) = (SELECT SUSER_SNAME())ĭECLARE VARCHAR(200) = CHAR(10) + 'Created on: ' + + ' by user: ' + + CHAR(10) SET = (SELECT = + ' FROM ' + TABLE(MD VARCHAR(MAX)) WHILE <= VARCHAR(1000) = (SELECT column_name FROM #temp WHERE Ordinal_position = + + ' AS VARCHAR(MAX))+ ''|'' + CAST( ' header |name |name2 |name3 |name4 |name5 |name6ĭECLARE INT = (SELECT MAX(Ordinal_position) FROM #temp) ĭescription: Turns result set of selected table into MarkdownĪND t.Table_name = t.table_schema = NVARCHAR(MAX)ĭECLARE NVARCHAR(MAX) = (SELECT '#Result for table: _**' + AS NVARCHAR(MAX)) + '**_ add the header and footer to the markdown notebookĬREATE OR ALTER PROCEDURE.This stored procedure is constructed from three parts: The process of exporting table rows into markdown format is done through stored procedure. Procedure will taking this table to export the result as markdown text. What I need to do, is to run the T-SQL query and store the results into a persistent table. For example, I have a long T-SQL query and I want to store the results as markdown text. The procedure will take as input parameter the table name and not the T-SQL query. In next step, I will populate this table with couple of sample rows for the demo purpose.
![easy markdown tables easy markdown tables](https://flug-mag-komme.com/csj/g_WKysgUqSedb1QDkWgO-QHaDx.jpg)
![easy markdown tables easy markdown tables](http://content.fromthepage.com/wp-content/uploads/2021/06/MarkdownTables.png)
Creating a test data setįirst, I will create a simple database with a sample table. The script is based on T-SQL and is standardize in such way, that you can use it in multiple platforms.
#Easy markdown tables software
You don't need any additional software and no additional requirements in order to to create markdown text. I will walk you through the process of creating the markdown formatted text for the T-SQL table output using a stored procedure.
#Easy markdown tables how to
In this article, I will explain how to create markdown formatted result set. This is shown in third cell, which holds the same result set but the results themselves are created with markdown language. But in addition, I can also create the markdown formatted text of the table content (or result set), so that the results are persistent, can be shared, copied elsewhere or simply added to documentation. Furthermore, I can export the result set to CSV, JSON or XML is another way to use the dataset with any other tool.Īnd ADS offers me also the easy way to visualize the results. I can also sort and, filter the columns without rerunning the SELECT statement. These capabilities with select statements (as shown in second cell) are created, so that people, I will be sharing notebook with, and myself, get most from your result set. In this way, they will have a better chance for data exploration, data understanding, and further collaboration with others. When I want to share this document with others, they will receive a complete notebook with code, comments, and text. The notebook gives me back the results, and I can also add the additional Markdown text as a comment to code. In the case below, I have created a new notebook, and executed a simple SELECT statement. Switching between kernels gives me much more flexibility to execute different functions that are available for me in different kernels. I normally use notebooks in ADS with all the different kernels. These notebooks can be execute many different script language, since their kernel can be based on R, Python, Powershell, Scala interpreters.
#Easy markdown tables code
I can use a markdown document on different platforms (JupyterHub, Databricks, Github, etc.), with different scripting languages (Python, R, Julia, Scala, SQL), and among different operating systems (Linux, Windows, Unix, MacOS, etc.).Īzure Data Studio (ADS) has offered creation of notebooks for a long time and delivers the basic concept of notebooks: executable code and formatted text in the same document. Formatting is easy to understand, readable, simple to adopt, and agnostic. It is widely used in tools for collaboration, tools for creating documentation and notebooks. Markdown is a markup language for creating formatted text. Markdown documents are becoming increasingly more popular and relevant with the emergence of notebooks.