Giter Site home page Giter Site logo

sqlprofilerquerycleaner's Introduction

SQL Profiler Query Cleaner

This is a little project I cooked up in less than an hour to save me some time.

SQL Profiler is a great tool to show you exactly what SQL is being executed, along with the parameters. This is especially useful when debugging, because sometimes you aren't sure what SQL is being executed.

However, often times I will find myself having to pull that SQL+parameters out of SQL Profiler and paste it into SQL Server Studio in order to analyze, tweak, debug, etc. SQL Profiler's output looks like:

exec sp_execute sql N'my sql with ''quotes'' escaped string',@MyParam1 datetime, @MyParam2 datetime,@MyParam1='2009-02-11',@MyParam2='2013-03-15'

Which is fine, and *executes* in SQL Studio, but if there's a syntax error, you can't really pinpoint exactly where in the query the error is, and it's harder to manipulate the parameters because you have to do it in two spots, and it's just time-consuming if you're doing this a lot (which I was).

So, fire up this program, paste the SQL Profiler output into the top text box, click the "Clean" button, and the bottom text box will have a more SQL Studio friendly query, like:

DECLARE @MyParam1 datetime='2009-02-11'
DECLARE @MyParam2 datetime='2013-03-15'

MY SQL STRING with 'quotes' that AREN'T ESCAPED

To do:
* This thing uses some really raw string parsing. I would prefer a SQL parser.
* Make this into a SQL Studio extension
* Make a command line/PowerShell version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.