February 25, 2009 at 8:57 am
Lynn Pettis (2/25/2009)
As I do use a case-sensitive collation, it forces me to be consistant with naming of variables, tables, columns, etc.
Okay, so I have to be honest and say that I'm not always consistent with case because I don't work with any case-sensitive collations. That's one of things I hate about the C-based languages and love about VB, I don't have to worry about case there either. Although I now have RedGate SQLPrompt and SQLRefactor which aids in consistency with case especially.
This is also one of the reasons I argue for using "_" as a separator instead of using the hungarian notation or Camel Case.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
February 25, 2009 at 9:02 am
Here is a compilation of the 5 best standards I have come across:
1. Don't foist standards on others.
2. See above.
3. On Monday to Friday, see above.
4. Over the weekend, see above.
5. When considering creating standards, see above.
Max
February 25, 2009 at 9:03 am
I think Best Practices need to follow the 80/80/20/20 rule. What makes sense 80% of the time for 80% of the people is what we should recommend.
Or as Andy Warren puts it, do this default until you know why you shouldn't
February 25, 2009 at 9:09 am
Max (2/25/2009)
Here is a compilation of the 5 best standards I have come across:1. Don't foist standards on others.
2. See above.
3. On Monday to Friday, see above.
4. Over the weekend, see above.
5. When considering creating standards, see above.
With all due respect, I disagree. In SSC, yea you are right or maybe right. But not in your own DB at your work place. If you want to see that your DB is working in the optimal way, you should have some basic standards that you enforce on the DB objects that you or your developers create.
-Roy
February 25, 2009 at 9:10 am
Jack Corbett (2/25/2009)
Lynn Pettis (2/25/2009)
As I do use a case-sensitive collation, it forces me to be consistant with naming of variables, tables, columns, etc.Okay, so I have to be honest and say that I'm not always consistent with case because I don't work with any case-sensitive collations. That's one of things I hate about the C-based languages and love about VB, I don't have to worry about case there either. Although I now have RedGate SQLPrompt and SQLRefactor which aids in consistency with case especially.
This is also one of the reasons I argue for using "_" as a separator instead of using the hungarian notation or Camel Case.
I actually prefer OrderHeader to order_header. I'll use the '_' in some cases, but shy away from it in naming tables, views, columns. I am also big on white space. I actually hate code that uses something like this: where cola=colb. Please, white space helps make code more readable, don't you agree?
Again, what it really comes down to when posting code is be consistant in what you do. I try to be consistant, and for me using a case-sensitive collation helps, plus we have PeopleSoft software for finance and hr, and it uses the Latin1_General_BIN collation.
February 25, 2009 at 9:10 am
Lynn Pettis (2/25/2009)
What is "best practices" actually? What is "best" today may not be "best" a week, or month, or year from now.
Which is one of the reasons I use the term 'recommended practice' and not 'best practice'
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
February 25, 2009 at 9:18 am
And yet one more example of things "getting worse"
February 25, 2009 at 9:22 am
Chris Morris (2/25/2009)
Grant Fritchey (2/25/2009)
I agree with Jack and Barry. Yes, I try to post that way all the time. No, I don't think we need to get into sweating standards like that.Don't you get the impression sometimes that the OP's want his query / sproc / function whatever to look as big and complicated as possible? Quite often I take the time to convert a chunk of code to using table aliases simply so I can get it small enough to reel the whole thing into my walnut-sized brain, but the OP's often completely ignore it. 'Course it's 'good practice', but it don't half help to follow what a bit of code is supposed to be doing!
Nevertheless, I'd stick with Grant on this one and keep it voluntary. It's all part of the learning curve innit.
I'll do the same thing. Plus I use Red Gate's SQL Prompt to reformat their stuff to make it more readable just for me, but that has the added benefit of making everything look pretty consistent. Now if I can get in the habit of using the spell checker as consistently.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 25, 2009 at 9:24 am
Steve, does that mean that this thread is not a good place for me to ask about that annoying little knock in my engine between 60-65 miles per hour?
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
February 25, 2009 at 9:25 am
Steve Jones - Editor (2/25/2009)
And yet one more example of things "getting worse"
Yeah, I've received one or two of those on my blog recently. It does seem like people are getting more desperate for this information but just don't have a clue how to go about getting it.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 25, 2009 at 9:27 am
Don't you get the impression sometimes that the OP's want his query / sproc / function whatever to look as big and complicated as possible?
When I see big honking strings of fully qualified table names and "odd" formatting, I usually assume that some query-generating software is the real author.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
February 25, 2009 at 9:34 am
Bob Hovious (2/25/2009)
Don't you get the impression sometimes that the OP's want his query / sproc / function whatever to look as big and complicated as possible?
When I see big honking strings of fully qualified table names and "odd" formatting, I usually assume that some query-generating software is the real author.
How true. PeopleSofts tools create poorly formatted SQL code. If I need to review that code, the first thing I have to do is reformat it so I can read it easier.
February 25, 2009 at 9:35 am
Welcome to megalomaniacs central, folks!
Don't bother us with your petty sql statements, do not ask us questions without reading the dozen or so best practice documents; blogs and forums and, above all, never do anything outside our standards and waste our valuable time - that we do not like.
We also strongly suggest that you take our carefully thought through standards to your workplace and imply that any colleague that doesn't study and use them is somehow inferior.
Max
February 25, 2009 at 9:43 am
I have to admit to being lazy about formatting and capitalization. I have a relatively consistent format, but I can't say that it's the easiest to read.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 25, 2009 at 9:43 am
Lynn Pettis (2/25/2009)
How true. PeopleSofts tools create poorly formatted SQL code. If I need to review that code, the first thing I have to do is reformat it so I can read it easier.
And this is one of the things that makes SQLPrompt and SQLRefactor so nice. I still need to figure out how to get it to format exactly to my preferences. Right now it is just close. I'm having to rethink my preferences because the tool does it just a bit differently.
Oh and I am with you on the whole white space issue. I typically have a lot in my code.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 15 posts - 1,966 through 1,980 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply