x

disable square braces when generating scripts from SSMS

How do I disable square braces when generating scripts from SSMS?

more ▼

asked Oct 12, 2009 at 10:27 AM in Default

binoj gravatar image

binoj
32 1 1 1

(comments are locked)
10|1200 characters needed characters left

7 answers: sort voted first

While it might bother you, it's a good practice. It ensures that any strange characters in your objects, spaces, etc., don't cause issues when you run the script. You might think you'll never do this, but with a version upgrade, that table you created in a previous version might not have a keyword for a name.

more ▼

answered Oct 12, 2009 at 10:53 AM

Steve Jones - Editor gravatar image

Steve Jones - Editor ♦♦
5.1k 77 79 82

Agreed. Probably best just to leave them in. However, Darren provided the way to remove them all if you really want them removed.
Jun 01, 2010 at 03:33 PM TimothyAWiseman
(comments are locked)
10|1200 characters needed characters left

I think it is a nuisance, and I agree wholehartedly with the questioner that there ought to be a way to kick it out. Although I have to admit that I occasionally use them when I accidentally use a reserved word, I don't see why one should not be able to enforce a 'standards' mode in a database, and do without the square braces. To illustrate the way that one can abuse all guidelines for sensible programming by means of square braces, see my blog post. Evil Code

more ▼

answered Oct 12, 2009 at 11:04 AM

Phil Factor gravatar image

Phil Factor
3.8k 8 9 16

Have to say I agree with you sir. I especially like the way that you can include square brackets in a name by double quoting - vb style. For example, a column called [[[]]] would appear in SQL text as [[[]]]]]. Neat. (!)
Oct 12, 2009 at 11:55 AM Matt Whitfield ♦♦
Prefer not to use them either, so annoying. Have a look at the following feature request, I added a comment to broaden its context a little: https://connect.microsoft.com/SQLServer/feedback/details/540306/ssms-improvements-required-for-dragging-columns-from-object-explorer
May 15, 2013 at 11:36 AM Valentino Vranken
(comments are locked)
10|1200 characters needed characters left

Currently there is no option to do this. It is SQL Servers fail-safe way of generating scripts for YOUR objects, that you might have named with a reserved keyword.

more ▼

answered Oct 12, 2009 at 10:51 AM

Kev Riley gravatar image

Kev Riley ♦♦
52.8k 47 49 76

(comments are locked)
10|1200 characters needed characters left

RegEx Find and Replace. Find "[[]]" Replace ""

more ▼

answered Jun 01, 2010 at 09:52 AM

Darren 1 gravatar image

Darren 1
11

That's a bit of a sub-standard approach, as it would blanket remove all square braces, even where they are required for non-natural identifiers.
Jun 01, 2010 at 10:24 AM Matt Whitfield ♦♦
@Matt, I agree with you, but if the original poster want to disable them then the poster presumably knows that they are not necessary. This is the closest thing to a direct solution to the original question I saw.
Jun 01, 2010 at 03:33 PM TimothyAWiseman
(comments are locked)
10|1200 characters needed characters left

You can't, as far as I know.

more ▼

answered Oct 12, 2009 at 10:49 AM

Matt Whitfield gravatar image

Matt Whitfield ♦♦
29.4k 61 65 87

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x343
x125
x67
x14
x1

asked: Oct 12, 2009 at 10:27 AM

Seen: 4523 times

Last Updated: May 15, 2013 at 11:36 AM