Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

Tabs or Spaces Expand / Collapse
Author
Message
Posted Monday, March 19, 2012 4:22 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 3:14 AM
Points: 1,807, Visits: 1,191
Tabs - you can post hoc indent or outdent blocks more easily.
Post #1268879
Posted Monday, March 19, 2012 5:45 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, December 11, 2014 10:03 AM
Points: 371, Visits: 737
Tabs all the way.
Post #1268902
Posted Monday, March 19, 2012 5:46 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, November 7, 2014 12:33 PM
Points: 28, Visits: 212
I agree with call.copse. Tabs all the way

Although I did learn the hard way not to tab after # and space in the powershell ISE(Autocomplete failed and the ISE crashed on me. Had to add the space since hitting tab after # doesn't do anything)
Post #1268904
Posted Monday, March 19, 2012 6:48 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:01 AM
Points: 1,228, Visits: 1,046
What makes this even worse is when you use universal source control.
The quickest way to mess up the spaces and tabs in our SQL source is when we extract it and check it into source control.
When you pull the SQL scripts back out of source control all the tabs and spacing are off. The code still works, but readability is terrible.
This is mostly caused by code that was written with Tabs set to 3 spaces instead of 5.
Post #1268927
Posted Monday, March 19, 2012 7:02 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 10:48 AM
Points: 20,857, Visits: 32,877
I have SSMS set to replace tabs with spaces. That way I use a tab to indent but it actually uses spaces.

If I need to change an indent on a block of code I simply highlight the block and use tab or shift tab depend on which direct it needs to go.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1268934
Posted Monday, March 19, 2012 7:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: 2 days ago @ 9:05 PM
Points: 7, Visits: 145
I've been in both environments regarding standards. Personal preference wise I use spaces; however I think the nail was hit on the head of a standard being put into place. Whatever the standard becomes it should be follow depicting unity among team members.

I don't really know if there is a wrong or right answer to this one; it is one that has and probably will all ways be battled out!
Post #1268953
Posted Monday, March 19, 2012 7:29 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, December 2, 2013 6:30 AM
Points: 346, Visits: 691
Nakul Vachhrajani (3/18/2012)

I always insist that my team has the "replace tabs with spaces" switch in SSMS options checked and also run code through the "beautifer" option of "Untabify selection".

In my humble opinion, there should be a consistent set of coding aesthetic standards that should be enforced by default (and result in warnings) by Visual Studio and associated tools.


THANK YOU!

I have been looking for that setting forever. I thought SSMS lacked it. Then I went looking again because of your post.

For anyone else who couldn't find it, it's Tools / Options / Text Editor / Transact-SQL / Tabs

Then set your tab and indent size, and choose "Insert spaces". Me, I use tabs set to 3 spaces...
Post #1268960
Posted Monday, March 19, 2012 7:31 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 12:55 PM
Points: 372, Visits: 989
Tabs

Cheers
Post #1268961
Posted Monday, March 19, 2012 7:49 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 27, 2014 5:23 AM
Points: 1,425, Visits: 1,316
Another point of view: Best setting is the default setting of the tool (SSMS, VS, ...). Otherwise you have inconsistencies by everyone who has forgotten to change the setting.
And some people reinstall very often.




See, understand, learn, try, use efficient
© Dr.Plch
Post #1268968
Posted Monday, March 19, 2012 7:51 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, November 10, 2014 6:19 AM
Points: 262, Visits: 919
tabs

To borrow from web design: semantic meaning. If the tab character (following newline) is taken to mean "indent" then four levels of indentation is literally 4 tab characters. I use tab to align the '=' following a field alias. In this usage it means align the equal sign to some visual column for the purpose of readability. It would be great to have the IDE understand this convention and implement it without requiring me to use multiple tab keystrokes to compensate for longer/shorter field aliases.

I feel that a space should be reserved to mean a literal space character.

I also agree that it's largely a non-issue when beautifiers can reformat valid code into any visual presentation you want. In that case the code is actually reparsed and any original whitespace is irrelevant.
Post #1268969
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse