Do you ever copy query results out of SQL Server Management Studio, paste them into your text editor, and then perform gold-medal find + replace gymnastics to create T-SQL scripts?
Do you ever need to copy a small amount of data from one SQL server to another, but don’t want to set up a linked server or take the time to create an SSIS package?
Do you ever need to create simple Excel sheets from SQL Server queries – preferably one tab per query result and with valid formatting (such as showing dates correctly and not truncating leading zeros)?
Have you ever wanted to quickly script a temp table that has the exact schema (including nullability and precision) of a query, stored procedure, or table-valued function?
If you answered yes to any of the above questions, there is a new add-on available for SQL Server Management Studio that you may like called T-SQL Flex.
T-SQL Flex is a free, open-source add-on for SQL Server Management Studio that does only two things:
- It scripts SQL query results to INSERT statements.
- It scripts SQL query results to Excel-compatible spreadsheets (specifically, XML Spreadsheet 2003 format).
Because T-SQL Flex does only these two things, it is very easy to use. Simply paste in your query and click the “Run ‘n’ Rollback” button. T-SQL Flex will create an ADO.NET transaction, run your query, collect the results, and then roll back the transaction.
You can check out the latest release here:
https://github.com/nycdotnet/TSqlFlex/releases
If you like T-SQL Flex, please let Steve know on Twitter:
Thanks to the team at Red-Gate that created the SIP framework used by T-SQL Flex.
Happy scripting!