Coder Social home page Coder Social logo

clipboardsqlformatter's Introduction

ClipboardSqlFormatter

Converting dynamic sql to static sql on the fly

What is it?

This is a tray application that listens your clipboard changes. When you copy to clipboard dynamic sql beginning with 'sp_executesql' then application try to convert it to a static sql. Converting includes two steps:

  1. Replacing parameters by its values
  2. Formatting sql structure to readable and easy to modify view

So when you copy such sql from SQL Profiler to SQL Management studio (for example), pasted text will be a static beautiful sql. Cool)

For example, if copied string is:

exec sp_executesql N' SELECT "obj"."CreateDateTime", "obj"."LastEditDateTime" FROM LDERC 
"doc" INNER JOIN LDObject "obj" ON ("doc"."ID" = "obj"."ID") LEFT OUTER JOIN LDJournal 
"ContainerID.jrn" ON ("doc"."JournalID" = "ContainerID.jrn"."ID") WHERE  ( "doc"."ID" 
= @V0 AND  ( "doc"."StateID" <> 5 AND "ContainerID.jrn"."Name" <> ''Hidden journal'' 
)  ) ',N'@V0 bigint',@V0=6815463'

pasted string will be:

SELECT "obj"."CreateDateTime"
	,"obj"."LastEditDateTime"
FROM LDERC "doc"
INNER JOIN LDObject "obj" ON ("doc"."ID" = "obj"."ID")
LEFT OUTER JOIN LDJournal "ContainerID.jrn" ON ("doc"."JournalID" = "ContainerID.jrn"."ID")
WHERE (
		"doc"."ID" = 6815463
		AND (
			"doc"."StateID" <> 5
			AND "ContainerID.jrn"."Name" <> 'Hidden journal'
			)
		)

Features

  • If you need to copy sql without any modifications, right click on application tray icon and uncheck item 'Is enabled'
  • For exit from application right click on application tray icon and choose item 'Close'
  • Move mouse to application tray icon and you will see current state of application - is is enabled or disabled.

Dependencies

For formatting sql I use an awesome library PoorMansTSqlFormatter

clipboardsqlformatter's People

Contributors

alex141 avatar whyer avatar

Watchers

 avatar

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.