Home All Groups Group Topic Archive Search About
Author
22 Oct 2007 8:24 PM
JW
Does anyone know how to get rid of the square brackets when generating code
in SSMS (besides manual search a replace every time!)? Is there a
configuration setting that I can chage to get rid of this abhorrent
default!!!!

Author
22 Oct 2007 9:52 PM
Erland Sommarskog
JW (J*@discussions.microsoft.com) writes:
> Does anyone know how to get rid of the square brackets when generating
> code in SSMS (besides manual search a replace every time!)? Is there a
> configuration setting that I can chage to get rid of this abhorrent
> default!!!!

There does not seem to be any such option.

http://connect.microsoft.com/SQLServer/feedback is a good place to
submit a suggestion for this. I found some entry, but it had been closed
in conjunction with the improvements they did for scripting they did
in SP2. However, they did not offer any options to lose square brackets
in that work.


--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
23 Oct 2007 6:56 AM
Tibor Karaszi
Count me in on this! Pls post back if you file such suggestion... :-)

Show quote
"Erland Sommarskog" <esq***@sommarskog.se> wrote in message
news:Xns99D1F3D33473CYazorman@127.0.0.1...
> JW (J*@discussions.microsoft.com) writes:
>> Does anyone know how to get rid of the square brackets when generating
>> code in SSMS (besides manual search a replace every time!)? Is there a
>> configuration setting that I can chage to get rid of this abhorrent
>> default!!!!
>
> There does not seem to be any such option.
>
> http://connect.microsoft.com/SQLServer/feedback is a good place to
> submit a suggestion for this. I found some entry, but it had been closed
> in conjunction with the improvements they did for scripting they did
> in SP2. However, they did not offer any options to lose square brackets
> in that work.
>
>
> --
> Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
15 Nov 2007 12:25 AM
Maciek Sarnowicz [MSFT]
Could you share some reasons why the square brackets are not welcome?

Regards,
Maciek Sarnowicz

Show quote
"Tibor Karaszi" <tibor_please.no.email_kara***@hotmail.nomail.com> wrote in
message news:uOKjhHUFIHA.1056@TK2MSFTNGP03.phx.gbl...
> Count me in on this! Pls post back if you file such suggestion... :-)
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
>
> "Erland Sommarskog" <esq***@sommarskog.se> wrote in message
> news:Xns99D1F3D33473CYazorman@127.0.0.1...
>> JW (J*@discussions.microsoft.com) writes:
>>> Does anyone know how to get rid of the square brackets when generating
>>> code in SSMS (besides manual search a replace every time!)? Is there a
>>> configuration setting that I can chage to get rid of this abhorrent
>>> default!!!!
>>
>> There does not seem to be any such option.
>>
>> http://connect.microsoft.com/SQLServer/feedback is a good place to
>> submit a suggestion for this. I found some entry, but it had been closed
>> in conjunction with the improvements they did for scripting they did
>> in SP2. However, they did not offer any options to lose square brackets
>> in that work.
>>
>>
>> --
>> Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se
>>
>> Books Online for SQL Server 2005 at
>> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
>> Books Online for SQL Server 2000 at
>> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>
>
Author
15 Nov 2007 2:39 AM
Roy Harvey (SQL Server MVP)
On Wed, 14 Nov 2007 16:25:49 -0800, "Maciek Sarnowicz [MSFT]"
<mac***@online.microsoft.com> wrote:

>Could you share some reasons why the square brackets are not welcome?

Just one person's opinion.

If naming conventions are used that follow the standards and avoid
keywords they serve no purpose.  My personal approach is that any
reference that requires square brackets was misnamed and should be
fixed.  And since I do not allow names that require square brackets, I
do not allow square brackets that could be hiding non-compliant names.
Along with the fact that they clutter things up and make things hard
to read.

I write clean code, and would like to keep it that way.

Roy Harvey
Beacon Falls, CT
Author
15 Nov 2007 8:28 AM
Tibor Karaszi
Exactly what Roy said (except for I'm sure that Roy writes cleaner code than I do ;-) ).

Since I always name objects according to standard identifiers, why would I have to clutter my
generated DDL scripts with square brackets? They make the generated DDL *much* harder to read...

This option is available in SMO, right? If so, please expose it in the GUI. Let me know if you want
a connect item for this, Maciek.
:-)

Show quote
"Roy Harvey (SQL Server MVP)" <roy_har***@snet.net> wrote in message
news:t2cnj350e3jr7f8debtk905kg4e3uhnh1m@4ax.com...
> On Wed, 14 Nov 2007 16:25:49 -0800, "Maciek Sarnowicz [MSFT]"
> <mac***@online.microsoft.com> wrote:
>
>>Could you share some reasons why the square brackets are not welcome?
>
> Just one person's opinion.
>
> If naming conventions are used that follow the standards and avoid
> keywords they serve no purpose.  My personal approach is that any
> reference that requires square brackets was misnamed and should be
> fixed.  And since I do not allow names that require square brackets, I
> do not allow square brackets that could be hiding non-compliant names.
> Along with the fact that they clutter things up and make things hard
> to read.
>
> I write clean code, and would like to keep it that way.
>
> Roy Harvey
> Beacon Falls, CT
Author
15 Nov 2007 8:56 AM
Erland Sommarskog
Maciek Sarnowicz [MSFT] (mac***@online.microsoft.com) writes:
> Could you share some reasons why the square brackets are not welcome?

They add noise and makes code more difficult to read.

Actually, I think there should be three options:

o  Always square brackets.
o  Square brackets when needed.
o  Never square brackets.

Roy seemed to prefer the latter, to catch badly named objects. But it
might be necessary with this option to make an exception: if you script
a table or an index is included, in most of the name the location is
PRIMARY which in this is context is a an identifier and not a keyword.

--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
15 Nov 2007 12:31 PM
Roy Harvey (SQL Server MVP)
On Thu, 15 Nov 2007 08:56:29 +0000 (UTC), Erland Sommarskog
<esq***@sommarskog.se> wrote:

Show quote
>Maciek Sarnowicz [MSFT] (mac***@online.microsoft.com) writes:
>> Could you share some reasons why the square brackets are not welcome?
>
>They add noise and makes code more difficult to read.
>
>Actually, I think there should be three options:
>
>o  Always square brackets.
>o  Square brackets when needed.
>o  Never square brackets.
>
>Roy seemed to prefer the latter, to catch badly named objects. But it
>might be necessary with this option to make an exception: if you script
>a table or an index is included, in most of the name the location is
>PRIMARY which in this is context is a an identifier and not a keyword.

I would be VERY happy with "Square brackets when needed."  That would
be optimal, even for me!   8-)

And let us not forget the one keyword in square brackets problem that
can not always be avoided: ON [PRIMARY] in a CREATE TABLE script.  Of
course Microsoft were the ones that used the keyword in this case.
That would be a clear case where "as needed" is needed.

Roy Harvey
Beacon Falls, CT
Author
16 Nov 2007 2:38 AM
Mike C#
"Erland Sommarskog" <esq***@sommarskog.se> wrote in message
news:Xns99E965FE3DCYazorman@127.0.0.1...
>
> They add noise and makes code more difficult to read.
>
> Actually, I think there should be three options:
>
> o  Always square brackets.
> o  Square brackets when needed.
> o  Never square brackets.

And a fourth option to complement these would be nice:

o use standard ISO double quotes instead of square brackets.
Author
16 Nov 2007 7:51 AM
Tibor Karaszi
> o use standard ISO double quotes instead of square brackets.

I'm with you on that. I'm a bit annoyed that MS prefers square brackets, when double-quotes is ANSI
SQL. You see square brackets in MS books, courses, posts, ... and script generations. IMO, it would
be nice if we could select what delimiter to use (if any).

Show quote
"Mike C#" <x**@xyz.com> wrote in message news:ORYqYn$JIHA.5468@TK2MSFTNGP05.phx.gbl...
> "Erland Sommarskog" <esq***@sommarskog.se> wrote in message
> news:Xns99E965FE3DCYazorman@127.0.0.1...
>>
>> They add noise and makes code more difficult to read.
>>
>> Actually, I think there should be three options:
>>
>> o  Always square brackets.
>> o  Square brackets when needed.
>> o  Never square brackets.
>
> And a fourth option to complement these would be nice:
>
> o use standard ISO double quotes instead of square brackets.
>
Author
16 Nov 2007 10:46 PM
Erland Sommarskog
Mike C# (x**@xyz.com) writes:
> And a fourth option to complement these would be nice:
>
> o use standard ISO double quotes instead of square brackets.

Or make that separate option. But, yes, this is a very good suggestion.



--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button