SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Tabs or Spaces


Tabs or Spaces

Author
Message
roger.plowman
roger.plowman
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1287 Visits: 1253
Rose Bud (3/19/2012)
Can anyone recommend a free or very inexpensive SQL Beautifier/Formatter which works well with complex queries? One that integrated with SSMS 2008 would be ideal.


I *love* SQL Prompt from RedGate, it's not terribly expensive and the Format SQL command has a two-keystroke shortcut (^K^Y). Does a bunch of other stuff too like enhancing intellisense. And it integrates into SSMS.
davidandrews13
davidandrews13
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1078 Visits: 4542
i prefer tabs to spaces.
main reason is probably because i can highlight multiple rows and tab them across where as if i did that with the spacebar it would delete the rows.
also because i think its easier to align rows with tabs.
SAinCA
SAinCA
SSC Veteran
SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)

Group: General Forum Members
Points: 206 Visits: 695
davidandrews13 (3/20/2012)
i prefer tabs to spaces.
main reason is probably because i can highlight multiple rows and tab them across where as if i did that with the spacebar it would delete the rows.
also because i think its easier to align rows with tabs.
In SSMS, highlight those rows and hit tab to move across or shift+tab to move left... I use spaces all the time and have zero deletions.
Possinator
Possinator
SSChasing Mays
SSChasing Mays (602 reputation)SSChasing Mays (602 reputation)SSChasing Mays (602 reputation)SSChasing Mays (602 reputation)SSChasing Mays (602 reputation)SSChasing Mays (602 reputation)SSChasing Mays (602 reputation)SSChasing Mays (602 reputation)

Group: General Forum Members
Points: 602 Visits: 1123
Heh, anyone else agree that anything produced by the Query Designer is visually heinous?

Looking for a Deadlock Victim Support Group..
Rudyx - the Doctor
Rudyx - the Doctor
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4941 Visits: 2503
This was entertaining - kind of like 'The Crusades' in the middle ages ...

Regards
Rudy Komacsar
Senior Database Administrator

"Ave Caesar! - Morituri te salutamus."
Todd M. Owens
Todd M. Owens
SSC Journeyman
SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)

Group: General Forum Members
Points: 82 Visits: 471
We share a peeve.
Todd M. Owens
Todd M. Owens
SSC Journeyman
SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)SSC Journeyman (82 reputation)

Group: General Forum Members
Points: 82 Visits: 471
Death to char(9) in SQL code:
1. Indented code characters will move one space, more than one space (depending on what user preference was) or not at all when inserting/deleting empty “space” in front of a line of SQL code when tabs are used along with spaces. One of those three things happens, and we cannot know which, if there are a combination of spaces and tabs to the left of SQL code when removing or adding to indention. Using tabs along with spaces violates the principle of least surprise.
2. Fact is we will present scripts in any number of tools where we can present text. Does anyone expect otherwise? We all should care about every text presentation tool we might routinely use, including Email, IM, Word Processors, Spreadsheets, et.al. No telling where a script might need including, and including them should be as simple as possible. While that last bit is an opinion, I like to think it so obvious it stands on its own merit.
3. It is a fact that not knowing whether a preceding character is a tab or a space makes using find and replace harder. For instance, replacing all space-comma-space with space-space-comma-space will miss all tab-comma-space. Or can some of you visually distinguish tabs in the editor?
4. The space bar is large; it is conveniently located (under either thumb); it is easy to strike multiple times rapidly. These are ergonomic facts and they are obviously less true for the tab key, which is much smaller, under-left-pinkie and more difficult to push even for a touch typist.
5. Disallowing an additional unseen character means we never have to code to allow for it while searching through or automatically formatting the text of our library of views, stored procedures or functions. This is a fact.
6. Overall, editing and re-editing code with tabs will take longer because of reasons stated in 1-5 above.

Fortunately we can use the tab key to insert spaces instead!
Steve Jones
Steve Jones
SSC Guru
SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)

Group: Administrators
Points: 65099 Visits: 19118
I'd argue these days we should have tools that reformat stuff for us. My company (Red Gate) makes one, but there are others.

We shouldn't have to worry about this stuff.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)

Group: General Forum Members
Points: 89417 Visits: 41144
Steve Jones - SSC Editor (7/3/2013)
I'd argue these days we should have tools that reformat stuff for us. My company (Red Gate) makes one, but there are others.

We shouldn't have to worry about this stuff.


Unfortunately and even with many options, none of them format code like I want it.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Steve Jones
Steve Jones
SSC Guru
SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)

Group: Administrators
Points: 65099 Visits: 19118
Jeff Moden (7/3/2013)
Steve Jones - SSC Editor (7/3/2013)
I'd argue these days we should have tools that reformat stuff for us. My company (Red Gate) makes one, but there are others.

We shouldn't have to worry about this stuff.


Unfortunately and even with many options, none of them format code like I want it.


I understand. I have a few requests into the Prompt team to allow a few more options.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search