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

Document The Code Please ! Expand / Collapse
Author
Message
Posted Thursday, December 26, 2013 8:57 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 22, 2014 12:24 PM
Points: 2,829, Visits: 8,477
Just a General Request.

When giving a helpful reply, throw in a few comments to explain some of the less obvious SQL statements. It can make a world of difference to have even a few words explaining some of the logic & syntax, and only takes a few seconds to type it.

It can save the reader, especially a newbie, lots of head scratching.



Post #1525978
Posted Thursday, December 26, 2013 9:17 AM


SSC-Dedicated

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

Group: General Forum Members
Last Login: Today @ 4:03 PM
Points: 36,983, Visits: 31,508
Yeah! Especially THIS guy!
http://www.sqlservercentral.com/Forums/FindPost1512914.aspx


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1525986
Posted Thursday, December 26, 2013 12:14 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 22, 2014 12:24 PM
Points: 2,829, Visits: 8,477
Jeff Moden (12/26/2013)
Yeah! Especially THIS guy!
http://www.sqlservercentral.com/Forums/FindPost1512914.aspx


Yes, great example of what not to do !



Post #1526019
Posted Thursday, December 26, 2013 12:43 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 3:10 PM
Points: 21,642, Visits: 15,311
Yeah that Forfiles syntax is throwing me for a complete loop

Seriously, notes in the code is extremely helpful. Especially if we are going to start tossing PoSH scripts up here as answers to questions.




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1526023
Posted Thursday, December 26, 2013 1:37 PM


SSC-Dedicated

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

Group: General Forum Members
Last Login: Today @ 4:03 PM
Points: 36,983, Visits: 31,508
SQLRNNR (12/26/2013)
Yeah that Forfiles syntax is throwing me for a complete loop

Seriously, notes in the code is extremely helpful. Especially if we are going to start tossing PoSH scripts up here as answers to questions.


Heh... I agree. Otherwise the PoSH scripts are just PoS.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1526036
Posted Thursday, December 26, 2013 1:40 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 3:10 PM
Points: 21,642, Visits: 15,311
Jeff Moden (12/26/2013)
SQLRNNR (12/26/2013)
Yeah that Forfiles syntax is throwing me for a complete loop

Seriously, notes in the code is extremely helpful. Especially if we are going to start tossing PoSH scripts up here as answers to questions.


Heh... I agree. Otherwise the PoSH scripts are just PoS.


Heh..fwiw - pun was not intended.




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1526038
Posted Thursday, December 26, 2013 1:40 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 22, 2014 12:24 PM
Points: 2,829, Visits: 8,477
What do wedding invitations have to do with SQL ?

http://www.poshscript.com/



Post #1526039
Posted Thursday, December 26, 2013 1:42 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 3:10 PM
Points: 21,642, Visits: 15,311
homebrew01 (12/26/2013)
What do wedding invitations have to do with SQL ?

http://www.poshscript.com/



ROFL - that was good




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1526040
Posted Wednesday, January 1, 2014 6:28 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 5:47 PM
Points: 3,627, Visits: 5,272
homebrew01 (12/26/2013)
Just a General Request.

When giving a helpful reply, throw in a few comments to explain some of the less obvious SQL statements. It can make a world of difference to have even a few words explaining some of the logic & syntax, and only takes a few seconds to type it.

It can save the reader, especially a newbie, lots of head scratching.


I suspect Jeff (and probably others) may disagree with me here but there's another school of thought.

While good comments explaining what is going on is great in Prod code, helpful answers to a forum question are those that help the OP learn.

That may mean a little bit of head scratching. Seriously, are you willing to dump some code into Prod just because you found it on the Internet? Better to dissect it and thoroughly understand it first. Comments may possibly distract you from doing that, by beguiling you into thinking that you know what is going on when in reality you may not.

I'm always available to answer questions if you don't understand some code I've posted.



My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.


Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1526964
Posted Thursday, January 2, 2014 1:17 AM


SSC-Dedicated

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

Group: General Forum Members
Last Login: Today @ 4:03 PM
Points: 36,983, Visits: 31,508
dwain.c (1/1/2014)
homebrew01 (12/26/2013)
Just a General Request.

When giving a helpful reply, throw in a few comments to explain some of the less obvious SQL statements. It can make a world of difference to have even a few words explaining some of the logic & syntax, and only takes a few seconds to type it.

It can save the reader, especially a newbie, lots of head scratching.


I suspect Jeff (and probably others) may disagree with me here but there's another school of thought.

While good comments explaining what is going on is great in Prod code, helpful answers to a forum question are those that help the OP learn.

That may mean a little bit of head scratching. Seriously, are you willing to dump some code into Prod just because you found it on the Internet? Better to dissect it and thoroughly understand it first. Comments may possibly distract you from doing that, by beguiling you into thinking that you know what is going on when in reality you may not.

I'm always available to answer questions if you don't understand some code I've posted.


Nope. I don't disagree at all. That's why I document the hell out of most of the code I post and do the "Alices Restaurant" thing with what I write up.

There are times, however (like the post I just answered about telephone number formats) where I believe the answer is simple enough that if the OP doesn't know what LIKE is, they should take it upon themselves to look up what LIKE does. Ostensibly, the OPs are "programmers" and they should know to lookup things they see in code that they don't know about.

As with all else, "It Depends".


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1526998
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse