SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Worst Practice - Spaces in Object Names


Worst Practice - Spaces in Object Names

Author
Message
rgerald
rgerald
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 2
I agree. We should "never" put spaces in object names, whether those objects are tables or fields.

One reason is this 'Object Name' (one space) and 'Object Name' (two spaces) are two unique objects - try to tell them apart in a code listing!

However, it's easy to tell the difference between 'ObjectName' and 'Object_Name'.



Steve Rosenbach
Steve Rosenbach
SSC Veteran
SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)

Group: General Forum Members
Points: 203 Visits: 206
>>I blame the practice on Access database users.<<
Poor, maligned Access users! :-)

I came to SQL Server via Access, but I *never* used spaces in names.

On the other hand, I've inherited more than one SQL Server database that never existed other than in SQL Server but where the developer used spaces and all kinds of other no-no's.

In Access, I always use "camel-case", e.g., UniqueNameForTable, and continue this practice in SQL Server. My pinkie hates jumping to the underscore character, so whenever I have a say in things, I don't use underscores in any object names.

My own biased opinion... I think using underscores to break up a name is a bad habit left over from older systems that don't preserve case, such as the "O" word...

Best regards,
SteveR



Steve Jones
Steve Jones
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: Administrators
Points: 62078 Visits: 19101
Isn't camelcase uniqueNameForObject?

In any case, I completely agree. Spaces are a pain!!!! especially when scripting.

I'd expand this to include stupid folder names as well (#$%#^#$%$# Program Files folder)

Steve Jones
sjones@sqlservercentral.com
http://www.sqlservercentral.com/columnists/sjones
The Best of SQL Server Central.com 2002 - http://www.sqlservercentral.com/bestof/
www.dkranch.net

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
gljjr
gljjr
SSChasing Mays
SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)

Group: General Forum Members
Points: 640 Visits: 1
As usual Andy, you have done a wonderful job writing your article! One of the first things I did when I got hired here was to create a SQL Best Practices document to help the people here to write better SQL. This is one of the topics I covered. Kudo's, and keep them coming Smile

Gary Johnson
Microsoft Natural Language Group
DBA, Sr. DB Engineer




Gary Johnson
Microsoft Natural Language Group
DBA, Sr. DB Engineer

This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.
philcart
philcart
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4096 Visits: 1436
quote:

I blame the practice on Access database users. Access allows this practice and then if the Access database has to be moved to SQL Server, those tasked with the move get bitten.



Don't blame the Access database users themselves. Have you ever produced a database using the Access Database wizard and not had spaces in object names??

If blame is to be laid anywhere it should be with the producers of the product that not only allows it, but provides tools that direct you towards developing that way.


Hope this helps
Phill Carter
--------------------
Colt 45 - the original point and click interface

Hope this helps
Phill Carter
--------------------
Colt 45 - the original point and click interface

Australian SQL Server User Groups - My profile
Phills Philosophies
Murrumbeena Cricket Club
Andy Warren
Andy Warren
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: Moderators
Points: 11463 Visits: 2730
Gary, thanks for the kind words. Any chance you could genericify that best practices document and submit as an article (or two)?

Andy
http://www.sqlservercentral.com/columnists/awarren/

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
gljjr
gljjr
SSChasing Mays
SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)

Group: General Forum Members
Points: 640 Visits: 1
Andy,

At this point I just don't have time to get the legal stuff I would need to have done to do that. Plus I believe there is already one on the Technet CD. I'll have to check on that. I'm just a developer who also has to do DBA duties. I actually have nothing to do with the SQL Server team.

Gary Johnson
Microsoft Natural Language Group
DBA, Sr. DB Engineer




Gary Johnson
Microsoft Natural Language Group
DBA, Sr. DB Engineer

This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.
David.Poole
David.Poole
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7500 Visits: 3282
I think the problem with Access is that it is an end-user database and as such has to be as simple and as forgiving as possible.

This is fine, but how many programmers start off with Access then migrate their skills to SQL Server?

Chances are that you pick up skills on the job and therefore the poor old Access developer learns about the pitfalls as he plummets into the hole grabbing handfuls of air as he falls.

I have a bee in my bonnet over the lack of training that companies put their employees through and the "make-do-and-mend" culture when it comes to tools.

After 5 days each on the original MS SQL 6.5 courses my productivity went through the roof and this obviously had massive benefits for my then employer.

I know that for small employers training costs are an issue but
  • They gain on employee productivity.
  • Their systems will be better built and thus more easily maintained.
  • If they can't afford training then they can contribute to it and/or give employees paid leave specifically for training.


LinkedIn Profile

Newbie on www.simple-talk.com
Andy Warren
Andy Warren
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: Moderators
Points: 11463 Visits: 2730
I figured it was of your own making, that's why it was interesting. If there is one on Technet, a link would be handy. We're hoping to have the topic covered in more detail soon, as one or more articles.

Andy
http://www.sqlservercentral.com/columnists/awarren/

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Tatsu
Tatsu
Say Hey Kid
Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)

Group: General Forum Members
Points: 664 Visits: 307

Wow! Hot topic... I don't know what the big deal is though. I like spaces in table names, column names, wherever...

JUST KIDDING!!!

I think a "best practices" option should be added to YUKON so default naming conventions can be enforced. For example, pattern match object names.

No! Please don't ask for more Yukon features!! We have waited long enough already!!!

I blame the practice on Access database users. Access allows this practice and then if the Access database has to be moved to SQL Server, those tasked with the move get bitten.

That would explain that horrible SQL Server sample database NorthWind... AARGH!!

Aaaah... fun with formatting and smileys. Can you tell it's Friday?!



Bryant E. Byrd, BSSE MCDBA MCAD
Business Intelligence Administrator
MSBI Administration Blog
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search