Monday, September 8, 2014

New Add-on for SSMS: T-SQL Flex

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.

TSqlFlexScriptToInserts

T-SQL Flex is a free, open-source add-on for SQL Server Management Studio that does only two things:

  1. It scripts SQL query results to INSERT statements.
  2. 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:

https://twitter.com/nycdotnet

Thanks to the team at Red-Gate that created the SIP framework used by T-SQL Flex.

Happy scripting!

5 comments:

  1. Followed install instructions, but add-in will not load in SSMS (SQL Server 2012). Any advice?

    ReplyDelete
    Replies
    1. Hi ChazLawler - sorry I didn't see this comment. Care to try again with the latest via Chocolatey? If you still have an issue, please raise on GitHub. I don't often get comments on my blog so I didn't see this until now.

      Delete
  2. Love tsqlflex! Had one of my queries timeout today. Is there any way to change the 30 second timeout ? I got my query to run in under 30 eventually but would like to up this limit a bit.

    ReplyDelete
  3. Hi Grazzhoppa - issue 44 is logged for this. There was some discussion on that issue by another user but it seems they haven't proceeded with developing the fix so feel free to take a stab at it if you want. If not, I will try to fix soon.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete