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

Coding Standards - Part 1 Expand / Collapse
Author
Message
Posted Sunday, May 5, 2002 12:00 AM


SSC-Dedicated

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

Group: Administrators
Last Login: Today @ 11:24 AM
Points: 33,088, Visits: 15,197
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/sjones/codingstandardspart1.asp






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #4032
Posted Thursday, May 9, 2002 3:55 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, May 29, 2012 11:22 AM
Points: 1,755, Visits: 4,652
Good article - it's interesting to see someone elses naming convention. Thanks Steve.

What about DTS packages and jobs? Does anyone have any naming conventions for those? We're currently reviewing ours and appreciate some ideas.

Thanks, Ryan.





Ryan Randall

Solutions are easy. Understanding the problem, now, that's the hard part.
Post #33050
Posted Thursday, May 9, 2002 5:36 AM
SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: Moderators
Last Login: Tuesday, April 22, 2014 1:22 PM
Points: 8,369, Visits: 734
Coding standards are great but seems you always have someone who just plain ignores them. Which is a shame.

As for DTS I suggest you make a name that will organize properly but a convention is not really a true neccessity here as you can include a package description. However the name should be a logical short version of the description or make a certain sense in helping quickly ID it. I usually use DBRelatedTO_ShortDescrip such as

PUBS_ExportAuthToXlsOnWeb

"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)



Post #33051
Posted Thursday, May 9, 2002 6:18 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Today @ 1:37 PM
Points: 6,779, Visits: 1,865
Not bad! We don't have one much of one here. While senior people may rebel a bit, junior developers LIKE having a standard to follow. Not only that, they tend to survive by cloning code frequently, so if you have a a bunch of different styles in use already, it just gets worse!

One thing I'd add, no spaces in database names either. If MS would PLEASE add a server configuration setting that will let disallow spaces in object names totally, that would SO useful.


Andy


Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #33052
Posted Thursday, May 9, 2002 7:15 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 9, 2010 7:55 AM
Points: 6, Visits: 4
Interesting, I liked the naming of the triggers.

Cheers, Joe.




Post #33053
Posted Thursday, May 9, 2002 8:51 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 25, 2014 7:19 AM
Points: 1,113, Visits: 6,440
Hey,

Great article. I was wondering how far out I would be with my naming conventions, but fortunately, I use pretty much all of those. Only ones I had not thought of was Triggers and Defaults!

With regards to DTS, I do try and adhere to a standard. All DTS Package names should give an indication as to the task. For example: JDE Inventory Download. For the description field I use the Database Name. Just found it easier that I could group the DTS's to see which data goes in which DB. As with all objects within the DTS, I always change their default description. For example, if I inserted an "Execute SQL Task", I'd change alter the Description to make it more meaningfull. But again, all that is documented!

One other standard which I just started to make my SP's meaningfull. I use <Application>_<SQL Statement>_<SP Name>. For example: SHOPFLOOR_INSERT_NEWORDER

And very much agree with Antares. Standards are great...however, trying to make others accept and adhere to your standards is another issue..!!



Clive Strong
clivestrong@btinternet.com
Post #33054
Posted Thursday, May 9, 2002 8:55 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, May 18, 2005 3:15 PM
Points: 1, Visits: 1
Nice Article. Our standards are similar but we include a further descriptive prefix to tables, views and procedures to enhance readablility in any consolidated documentation for projects.
These include a single letter identifiying the object type ( 't' for tables, 'v' for views, 'p' for procs) and a single letter for basic function ( 'l' for lookup, 's' for static, 't' for transaction, 'p' for procedural ).





Post #33055
Posted Thursday, May 9, 2002 9:25 AM


SSC-Dedicated

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

Group: Administrators
Last Login: Today @ 11:24 AM
Points: 33,088, Visits: 15,197
Thanks for the comments. As far as DTS pacakges go, I haven't done enough work in a multi-DBA environment to come up with a good one. I have done the following:

DBAxxxxx - DBA related jobs (backup, etc.) with the xxx being a description.

ExtractXXXXX - Extraction procedures for
processes that I use to move data out of the database and send it somewhere else.

Generate XXXX - DTS packages that generate data that is sent to a person, like a report.

That's about as far as I've gotten. I like Antares idea for DTS packages.

as far as adherence. I've never had an issue with going to a manager and asking for adherence. Then I get them to lean on the others.


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 #33056
Posted Thursday, May 9, 2002 9:59 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Wednesday, April 30, 2014 9:23 AM
Points: 649, Visits: 206
Good article. (Was that an echo?) It is always worth reading up on how other people do, let's call it "non-standardized" things, such as naming and coding conventions. Eventually, they become widespread standards, or so one can only hope.

A quick thought or two: for indexes and the like, instead of tagging them with a number we put the column actually indexed at the end (such as PK_Table_ColumnName). For compound indexes, either we do multiple columns, a brief description, or (if too long) an arbitrary number (1, 2, etc.) All this makes it easier to get a list of indexes for a table and see what's covered and what's not.

I'll toss in our foreign key naming conventions: FK_<child table constraint is "owned" by>_<parent table constraint references>. Having consistent names on the "hidden" database objects (indexes, defaults, constraints, triggers) has made management a LOT easier the few times it's really mattered.

Steve, just from idle curiosity, and with no intent to provoke lengthy debate on points of religious dogma, are there an particular reasons why do you avoid underscores and all-upper case words? We mix and match in what I like to think of as a judicious fashion. When reading code or reports, quick visual identification of disparate objects can be very useful.

Philip





Post #33057
Posted Thursday, May 9, 2002 11:33 AM


SSC-Dedicated

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

Group: Administrators
Last Login: Today @ 11:24 AM
Points: 33,088, Visits: 15,197
I do agree that quick identification can be usefu. One reason why I put the tablename first is so all items relating to the table are close together.

As far as underscores go. No real reason other than I had to pick something and tend to prefer UsingProperCaseNames to Using_Proper_Case_Names. Shorter, plus this is what MS decided to recommend for the .NET stuff. I always disliked the all CAPS stuff in C for constants. I know they stand out, but I've never had an issue running through code and checking variables. If I'm confused or new, I should be extra careful anyway before changing the code. Plus it's easier for me to just be consistent than to try and figure out if I should be making something all CAPS.

Not against it and if I worked in your shop, I'd adapt. Just what I decided was easier.


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 #33058
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse