You can use simple T-SQL string function to get a query result in Html table format, see for example
https://www.red-gate.com/simple-talk/blogs/generating-html-sql-server-queries/
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello Everyone ,
Is there any way where to convert my TSQL query output to physical html file?
Regards
ChetanV
You can use simple T-SQL string function to get a query result in Html table format, see for example
https://www.red-gate.com/simple-talk/blogs/generating-html-sql-server-queries/
It seems that your question contains two parts:
First part
(X)HTML composition is relatively easy to implement in T-SQL by using T-SQL and XQuery.
It is much better approach in comparison with string concatenation.
Benefits:
• It creates a guaranteed proper (X)HTML.
• Easy to test in both SSMS and any internet browser.
• It is dynamic and can handle both SQL variables and tables.
• It supports both CSS styles: embedded and included.
Check it out here my answers on the forum on the same subject:
Second part
bcp, command line utility, can generate a file on the file system based on a query.
Hi @chetan Vishwakarma ,
If you just want to generate html format from the output of sql server, the methods provided by the above two experts can be used. But if you want to generate a physical html file from the output, you may need ssis to achieve it.
If you have any question, please feel free to let me know.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.