This stored procedure converts a table or select query to an HTML table format, with some customization options.
A script Carlos Robles from dbamastery.com provided me for a static table was taken as the base, so I modified it to accept any table or select query and apply different or no styles, also you can choose to show or hide columns from the final table.
- This SP works with dynamic queries, also data is not validated, so it is vulnerable to SQL injection attacks, so always validate and sanitize your queries before using it.
- Null values are not converted on this initial release, so before using it, remove null values from your data.
- Some special data types like geography, timestamp, XML, image are not supported, if you try to use them, an error will raise, remove these columns before using it.
- This tool is not designed to handle huge amounts of data, so, for massive information, you can split them in various executions.
Quick tutorial here