May 24, 2011 at 2:07 pm
How to format SQL for reading easier? For example, change the following code to separate lines.
select aaa, bbb,ccc, ddd, ..., from order
became
select
aaa,
bbb,
ccc,
...
from order
May 24, 2011 at 2:21 pm
Red Gate SQL Prompt Pro
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
May 24, 2011 at 2:27 pm
indenting code is your best friend.
while there's no hard and fast rules, i tend to do something like this:
columns indented compared to the select
joins are indented from the FROM statement
this is how i, personally, without approval from anyone else, tend to format my statements for readability...your mileage may vary.
SELECT
aaa,
bbb,
ccc,
COLUMNLIST
FROM [order]
INNER JOIN [OtherTables]
ON [Order].OrderId = [OtherTables].OrderID
WHERE Criteria = 1
ORDER BY
aaa,
bbb,
ccc,
COLUMNLIST
Lowell
May 24, 2011 at 2:55 pm
Another vote for SQL Prompt Pro[/url]. I'd hate to live without that software.
However, you could try the Simple-Talk SQL Prettifier.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 24, 2011 at 8:16 pm
Take a look at SQL Assistant from SoftreeTech - this is another tool much like SQL Prompt. This tool works on multiple database systems (SQL Server, Oracle, mySQL, etc...) and also will work with multiple editors include notepad, notepad++, UltraEdit, etc...
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply