Engaged in enterprise system development for many years, in the system workflow analysis, it is necessary to analyze the SQL statements, when the system accumulated to a certain scale, the database table involved in the geometric number of growth, so often run into a very long SQL statements, involving more than dozens of tables, when you get such a piece of SQL, Need to analyze the relationship between the tables, the head is a bit big! I Google a bit, did not find the SQL statement to break and indent the tool, but the work is often encountered this SQL, manual to break and indent, but also a mechanical duplication of work, so "lazy" strength up, My own weekend developed a simple auxiliary tool, while sharing to everyone, I have uploaded programs to provide downloads.
Let me briefly introduce the development principles:
(1). In SQL statements: From\select\union\where encounters these keywords will wrap automatically, if nested will automatically indent.
(2). The Select section is very long and will also wrap automatically, and the case section will automatically wrap.
There are 3 files in the program:
BreakSQLCmd.exe: Command line tools
BreakSQLUI.exe: Interface tools, as well as command-line tool functions
ObjString.dll: DLLs that contain the actual functionality
And then I'll explain how to use it:
(1). BreakSQLCmd.exe: First to split the SQL copy (Ctrl + C), and then execute the BreakSQLCmd.exe, after the successful execution, the split of the SQL copied to the Clipboard, you are in the Query Analyzer paste (ctrl+z) on the line. The following diagram of the interface:
(2). BreakSQLUI.exe: This has the UI, the operation is simple, the interface is as follows:
These two EXE execution results are the same, you can choose the way you like!
If you find the problem in use, you can reply to me, and enclose the SQL, I can improve the:)