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 12345»»»

Worst Practices - Part 1 of a Very Long Series! Expand / Collapse
Author
Message
Posted Sunday, October 7, 2001 12:00 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Friday, August 29, 2014 8:46 AM
Points: 6,783, Visits: 1,881
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/awarren/worstpracticespart1ofaverylongseries_1.asp>http://www.sqlservercentral.com/columnists/awarren/worstpracticespart1ofaverylongseries_1.asp

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #1241
Posted Sunday, October 7, 2001 7:59 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, February 19, 2003 12:00 AM
Points: 14, Visits: 1
Andy, thanks for the start of what I'm sure will be a very interesting series.

On Hungarian Notation, I agree that it's probably WP to use it on column names but if people want to change thier column names then there is a tool that will help - Speed Ferret www.speedferret.com. I like this tool because it does give you the ability to change your mind as the database grows and changes - there are a few restrictions to it however - it does not yet support SQL Server 2000 (I've used it a few times but with great care - ie back up the database first), and there's no way to change column names referenced in your ASP although it will work with VB. (for changing ASP I use windows Grep www.wingrep.com)

on Naming Conventions generally I've always stuck by the rule that It doesn't really matter what the naming convention is, as long as it is documented and ahdered to. A good BP/WP article/discussion could be had on the use of the tbl prefix before each table name (vw for views etc). Some people are passionately against it and say it adds time to reading the code. I use it personally because our DB has a view on each table and I need to know whether it's the view or the table when I'm reading a SQL Statement. Any other views on this?



Edited by - jodiem on 10/07/2001 8:09:31 PM



Post #22145
Posted Sunday, October 7, 2001 11:43 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, December 24, 2001 12:00 AM
Points: 8, Visits: 1
I graduate from university last year and what you are saying is what i was taught. I irony is that been in the work place for 1 year i have found most of the databases within the company i work for do not follow the way i was taught/you have noted. It's a pain the the butt as it takes ages to understand the database.

Rock on, i wish more "IT/database proffesionals" would read and follow you suggestions, it would save agravation + time




Post #22146
Posted Monday, October 8, 2001 1:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 4, 2003 12:00 AM
Points: 3, Visits: 1
Good start to what i'm sure will be a very interesting series ! I am in the middle of creating a BP guide for my development team so I shall be keeping a close idea on the boards.
My take on the last example of WP (hungarian notation for column names) is slightly different. The fact that it is considered a WP is surely more to do with the limitations of SQL Server than the actual practice being poor in that there is no global search and replace functionality with SQL Server.
I guess that using hungarian notation in column names, where it is such a pain to change as the db becomes more sophisticated, really emphasises good analysis and design.




Post #22147
Posted Monday, October 8, 2001 2:39 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 1:07 AM
Points: 2,901, Visits: 1,805
I agree with using Hungarian notation for objects and variables.

I would NOT use it for anything that a user might see such as a column name.

I picked up the idea of using Hungarian Notation from Ivor Horton's C++ book and it seemed like a good idea. Although aimed at variables, pointers, properties and classes there was no reason to limit it to C++, VB etc.

Are there any agreed standards for SQL objects or indeed objects in general?
I use:-
Tbl_ identifies a table.
Idx_ identifies an normal index.
Pk_ identifies a primary key.
Unq_ identifies a unique key.
Vw_ identifies a view.
usp_ identifies a user (non system) stored procedure
uxp_ identifies a use (non system) extended stored procedure.
df_ identifies a default.
rl_ identifies a rule.
ty_ identifies a user defined type.

If you are going to use some form of Hungarian Notation then it has to be adopted as a standard across the organisation.



LinkedIn Profile
Newbie on www.simple-talk.com
Post #22148
Posted Monday, October 8, 2001 4:55 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Friday, August 29, 2014 8:46 AM
Points: 6,783, Visits: 1,881
Thanks for all the comments so far! I have not tried Speed Ferret, but I do have a freeware add-in for VB that does much the same thing. David, I do like Hungarian for objects I think - with the exception of table. I know that's not exactly consistent! One thing to consider is that the one place in VB where it's recommended that you NOT use this notation is in public objects. If you're providing users with a class contained in a dll, all the methods and properties should be 'English', not 'Geek'!

Andy



Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #22149
Posted Monday, October 8, 2001 11:34 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, February 2, 2009 3:11 PM
Points: 1, Visits: 5
Andy, I too am really looking forward to this series. I have never seen hungarian notation used in column names. I do agree it would be a disaster! The practice I use with columns is to append part of the table name to the column (except foreign keys). The classic Employee table is a good example. The column names might be empID, empLastName, empFirstName, etc. When working on tables I always keep a copy of the data dictionary handy and that's how I determine the data type and domain of the field. It also helps (a BP of course) to have data standards. So e.g. if zip code is always a 9 character text field, any time I see zip code, I know the data type. Of course, this doesn't always work with legacy databases.
Anyway, keep up the good work!



Post #22150
Posted Monday, October 8, 2001 12:05 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Friday, August 29, 2014 8:46 AM
Points: 6,783, Visits: 1,881
Something I see used VERY little is user defined type - talk about self documenting, look over to see that the column is of type zip code. Now whether that is a BP or WP is a subject for another day!

Andy



Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #22151
Posted Monday, October 8, 2001 2:37 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 8:53 PM
Points: 33,204, Visits: 15,353
I'm with Andy on this one. I used to use Hungarian notation in coding, but never in column or object names. I think it is a disaster. Tool or no tool, the rebuild time for a table might be way too high for a name change.
One other note, since I've started working with .NET, MS does not recommend using hungariang notation, at least for C#.


Steve Jones
steve@dkranch.net







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #22152
Posted Monday, October 8, 2001 3:03 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Friday, August 29, 2014 8:46 AM
Points: 6,783, Visits: 1,881
Did they give a reason why (for not using Hungarian)?



Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #22153
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse