an option to remove Square Brackets from coding. - by Unreal Chris

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 378725 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 10/30/2008 10:44:43 PM
Access Restriction Public


I would like to be able to have an option to specify that the square brackets are not included in the code generated by SQL Server 2005. I write proper code and have not use for these square brackets at all.
Sign in to post a comment.
Posted by DaveBolt on 11/10/2014 at 2:46 AM
To illustrate: [square] [brackets] [decrease] [readability] [and] [clarity]. [They] [do] [not] [increase] [it], [as] [you] [say]
They are *only* useful where identifiers do not conform to best practises, and never at any other time ever whatsoever.
If you are concerned about having another "knob" to control scripting, we are more than happy to have another "knob" to disable this annoying behaviour.
Posted by AndyKr on 2/5/2014 at 7:04 AM
I agree totally with Great Scott1 in his comments. Having just started working with SSMS 2012 I am finding the constant insertion if unnecessary delimiters a major distraction plus, as he pointed out, they not only "protect" you forom stupid naming but also HIDEs the fact that the name is improper - and the result is code that should throw an error, doesn't!
This is NOT a good thing.
Surely, since it is possible to identify key words and thier context (for syntax highlighting if nothing else) it would be possible to only add the square bracket when a reference is recognised as a key word in a non-valid context. After all, the RedGate tools (SQL Prompt 6.0) manages to handle it this way, why can't Microsoft adopt a similarly sensible solution instead of this One-Size-Fits-All with no options nonsense?

And while they are at it, perhaps they would also consider adding back the ability to run MDI. Tabs are fine unless you need to view TWO different tabs at the same time!!!!
Posted by Lerxst1 on 8/13/2013 at 10:50 AM
I agree completely with Darren M B. I do not understand why Micro$oft cannot at least offer the option to turn this idiocy (excuse me... "feature") on or off per user preference.
Posted by Darren M B on 6/18/2013 at 6:08 AM
Square Brackets breaks the most important thing in my opinion, the readability of the SQL. Add nested statements and functions and these additional unneeded brackets make your code downright difficult to read. This is amplified in a group environment where you may not have written the SQL in the first place.

I beleive forcing this on people is another example of Microsoft killing a fly with a sledgehammer.

If I'm truely stupid enough to use a breaking keyword as a column or table name I would prefer SQL would not run at all. As a best practice we use descriptive names (usually at least 2 words in allmost all cases) and I have NEVER required a square bracket in my code EXCEPT where I want the resulting output column Name to have a space in it for readability.

You will notice there is a metadata function in SQL that returns all the reserved words in .NET (don't remember it offhand, but it is in the GetSchema/OpenSchema command) and clearly the "Edit" view of a table uses something akin to this to decide if square braces are required before putting them in. So why is this not applied in the "Query" window in SQL Manager?

If I could drop back to SQL manager 2008 I would do so. As it is I'm considering writting an "unsupported addin" to remove this stupidity because on a daily basis I'm either manually deleting all the brackets when there added or I'm using the "Rename" in the treeview to "Copy" the name, which can be downright dangerous since I could easily accidentally rename an object.
Posted by Great Scott1 on 5/21/2013 at 5:11 AM
Square brackets cause the following problems:
1. they allow you to run code that breaks best practice (e.g. spaces or reserved words in object names)
2. they obscure the fact that the code breaks best practice
3. they make scripts much harder to read visually

If users want to run scripts that REQUIRE square brackets that is fine. Those of us who want to follow best practice in naming objects (i) don't need them (ii) find that they make the job harder not easier. Surely the best practice option is not to have square brackets unless they are required.

PLEASE, PLEASE, PLEASE, Microsoft, at least give us an option to remove them. Better still, make the default option not to have square brackets and allow those who wish to use poor naming conventions add them in.

Posted by Valentino Vranken on 5/15/2013 at 4:32 AM
One more vote for this option. It's not because it's a best practice that we shouldn't at least get the option. I prefer to not use square brackets unless they can't be avoided.
Posted by DeletedAccount on 3/1/2012 at 12:50 PM
While I think it's "Nice" to always have any suggestion you want in your Gui/coding environment, I'm assuming you're referring to the "Delimited Identifiers", and you.

1. set those yourself
2. I would suggest you write a macro to remove them, bam, one click you're done and it's totally custom for YOU, not someone else, problem solved, no more worries, no waiting on some future fix that isn't really important to functionality anyway.

Posted by jlmcc on 2/16/2011 at 2:57 AM
I also agree with BSan we have gone to considerable trouble in the naming of our objects and do not require square brackets. I feel square brackets only add clarity to a parser not a human being. Everytime i script an object using SSMS i have to remove square brackets to make the script clearer.

Please please reconsider.
Posted by BSan on 1/21/2011 at 3:26 PM
I totally disagree with your decision. Adding square brackets is a nuisance. IN SMSS reserved words are color coded. Putting brackets around data types in scripting Create Table statements defeats the wonder color coding feature. Please reconsider.
Posted by Microsoft on 10/9/2009 at 6:46 AM
Dear customer,

Thanks you for your suggestion.Using square bracket around names is good practice increases clarity and prevents occasional mistakes.Also with already present high number of knobs for scripting,we feel adding one extra knob is further going to add to the woe.So we are not incorporating this suggestion.
Posted by Microsoft on 6/30/2009 at 11:01 AM
Thanks for your feedback. We will look to consider this in our future release. Having the square bracket is important for clarity as well. We might consider providing this feature in the future releases.