Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

Worst Practice - Spaces in Object Names Expand / Collapse
Author
Message
Posted Sunday, September 28, 2003 12:00 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Yesterday @ 12:08 PM
Points: 6,790, Visits: 1,904
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/awarren/worstpracticespacesinobjectnames.asp>http://www.sqlservercentral.com/columnists/awarren/worstpracticespacesinobjectnames.asp

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #16742
Posted Tuesday, September 30, 2003 7:31 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, August 13, 2012 2:37 PM
Points: 2, Visits: 67
also, not only table naming conventions, but field naming conventions. it is really tough to write queries that join two tables where they both have fields named "id" to join on. It gets even worse when you add more fields, joins, etc. True, you can alias columns and tables (a.id = b.id), but that is a pain and is avoidable by naming the fields the "right" way!


Post #81262
Posted Tuesday, September 30, 2003 9:00 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, October 22, 2014 10:44 PM
Points: 2,693, Visits: 1,213
add to this, avoiding the use of non-alphanumeric characters, wildcards, etc...
eg: tblName%

Arrrgghh!!!!

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
Post #81263
Posted Wednesday, October 1, 2003 1:46 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 1:28 PM
Points: 2,908, Visits: 1,834
I agree with this 100%
  • Don't use spaces in table names
  • Stick to alphanumerics, (preferably without the numerics unless you absolutely must)
  • Don't use reserved words for tables i.e have a table called "Order" or "Exists"!


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



LinkedIn Profile
Newbie on www.simple-talk.com
Post #81264
Posted Wednesday, October 1, 2003 2:42 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, October 23, 2008 7:24 AM
Points: 15, Visits: 2
I guess people do it for readability, but I've always used the '_' (underscore) if I've needed to put a gap between words in a table name.

eg. New_Table_Name




Post #81265
Posted Wednesday, October 1, 2003 3:22 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, March 13, 2012 9:34 AM
Points: 141, Visits: 61
Totally agree - bad enough that data types can't be standardised across databases/programming languages, let alone adding nonsense like spaces and underscores to object names. Added to which, doesn't it contravene ANSI standard SQL, which would make it more difficult to port?

Jon Reade

Edited by - jonreade on 10/01/2003 03:52:31 AM



Jon
Post #81266
Posted Wednesday, October 1, 2003 4:46 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Yesterday @ 12:08 PM
Points: 6,790, Visits: 1,904
I'm going to a follow up to hit on the object naming thing a little harder - you guys are right, spaces arent the only bad thing. Just particularly objectionalble to me!

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




Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #81267
Posted Wednesday, October 1, 2003 6:43 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, May 16, 2011 1:14 PM
Points: 440, Visits: 66
Thank you! I have been fighting this battle for years! Nothing is as frustrating as writing out the query, or grabbing columns from the object browser, hitting execute and getting an error because I need brackets around some object. Egad! Just don't do it! Embrace the non-spaced object naming convention!

There are indeed many "worst practices" to avoid, but this is so easy to avoid.




Post #81268
Posted Wednesday, October 1, 2003 12:15 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, November 5, 2013 9:05 AM
Points: 976, Visits: 59
I see no reason to use spaces for object names or column names. To me TableName is just as easy to read as Table Name and then I don't have to see those brackets which just cluter up the screen.

Robert W. Marda
SQL Programmer
bigdough.com
The world’s leading capital markets contact database and software platform.




Robert W. Marda
SQL Programmer
Ipreo
Post #81269
Posted Wednesday, October 1, 2003 12:54 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, September 29, 2014 12:33 PM
Points: 186, Visits: 378
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.




Post #81270
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse