THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Greg Low (The Bit Bucket: IDisposable)

Ramblings of Greg Low (SQL Server MVP, MCM and Microsoft RD) - SQL Down Under

Do you find T-SQL scripts hard to read with all the square brackets?

This blog has moved! You can find this content at the following new location:

Published Saturday, August 3, 2013 2:08 PM by Greg Low

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



WayneS said:

Greg - Are you proposing a third parameter to the QUOTENAME function?

QUOTENAME already has an optional parameter to specify what the text should be quoted with. BOL says you can use a square bracket (left or right), or a single or double quote character. My testing shows other characters that works with this function - CHAR(34, 39, 40, 41, 60, 62, 91, 93, 96, 123, 125) all work.

I agree that a way to only quote the needed names would be desirable.


August 8, 2013 12:43 AM

Greg Low said:

Great point Wayne, I was forgetting that it already had an optional quote character parameter. (I never use that parameter). So yes, I'd be suggesting a third parameter that's also optional.

August 8, 2013 1:09 AM

RichB said:

I'd like to go a stop further to see a server side setting that prohibited 'complex' or reserved object names.  

I mean, really, who's the genius that thought putting full stops in database names was a good idea?

August 12, 2013 8:47 AM

Greg Low said:

You can already do that to a fairly large degree. You can create a DDL trigger that rolls back any object creation with names you don't like. If we had this function, that would make it even easier but you might also like to have even stricter rules.

However, you can't roll back CREATE DATABASE. I can also see a trend towards more DDL statements that aren't transactional i.e. ones that also can't be rolled back. That's one (amongst many) of the reasons why I'd like to see INSTEAD OF triggers for DDL. Adam Machanic and I have been pushing for that for a long time to little avail. Here's Adam's latest Connect item for it:

August 12, 2013 8:32 PM

Leave a Comment


This Blog



No tags have been created or used yet.


Privacy Statement