November 12, 2015 at 7:23 am
jasona.work (11/12/2015)
jasona.work (11/12/2015)
Grant Fritchey (11/12/2015)
jasona.work (11/12/2015)
BrainDonor (11/12/2015)
My Grandmother had an expression, when she thought somebody was being really lazy - "Sit down and I'll walk around for you" - http://www.sqlservercentral.com/Forums/Topic1735905-392-1.aspx#bm1735907I just glanced at the pop-up summary and the title, and my first thought was "homework."
It's almost tempting to take some time one evening for one of these (I think) fairly obvious homework questions, to come up with the most complicated, hard to read, redundant, confusing, redundant, obfuscated queries possible, that still returns the expected results.
But my time is worth more than trolling someone like that...
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.
Make sure to put it all on one long line...
π
It would almost be worth it, *if* I could be a fly on the wall when the instructor asks them to explain their query...
:hehe:
Coming soon!
The official, unofficial, not approved, not not unofficial SQL Server Central query obfuscation contest! Write the simplest query in the most complicated way possible! Prizes include, but are not guaranteed to be:
9. One of Steves' Hawaiian shirts!
4. Signed picture of Grant Fritchey with muttonchops and a soup-strainer mustache!
3.14. Gail Shaw at your birthday party in a Deadpool costume!
:hehe:
(Gotta love how I volunteer others for this!)
All prizes subject to availabilty and willingness of the participants, offer not valid within the Sol system or its' Oort cloud.
If we're going to do that...
Write the code for the most basic use of DBCC TIMEWARP()
November 12, 2015 at 7:23 am
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
November 12, 2015 at 7:30 am
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
November 12, 2015 at 7:39 am
Brandie Tarvin (11/12/2015)
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
That sounds like the conversations I have with myself when cracking open code I haven't seen in a few months. π
"Why did I write this like this? What the #$@% was I thinking? Oh well, it works."
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
November 12, 2015 at 7:59 am
Sean Lange (11/12/2015)
Brandie Tarvin (11/12/2015)
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
That sounds like the conversations I have with myself when cracking open code I haven't seen in a few months. π
"Why did I write this like this? What the #$@% was I thinking? Oh well, it works."
Y'all are driving me nuts with this. This is why you put in comments on WHY you did it the way you did it, so when you go back you at least know the original reason.
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
November 12, 2015 at 8:01 am
Jack Corbett (11/12/2015)
Sean Lange (11/12/2015)
Brandie Tarvin (11/12/2015)
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
That sounds like the conversations I have with myself when cracking open code I haven't seen in a few months. π
"Why did I write this like this? What the #$@% was I thinking? Oh well, it works."
Y'all are driving me nuts with this. This is why you put in comments on WHY you did it the way you did it, so when you go back you at least know the original reason.
Yes, you need to put some useful comments in your code, such as:
--Don't touch this or it might stop working.
:hehe:
November 12, 2015 at 8:03 am
Jack Corbett (11/12/2015)
Sean Lange (11/12/2015)
Brandie Tarvin (11/12/2015)
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
That sounds like the conversations I have with myself when cracking open code I haven't seen in a few months. π
"Why did I write this like this? What the #$@% was I thinking? Oh well, it works."
Y'all are driving me nuts with this. This is why you put in comments on WHY you did it the way you did it, so when you go back you at least know the original reason.
Oh, I comment the crap out of my stuff. I've got one proc that has almost 2 pages worth of version history comments (if I printed it out in Word). But it's so complicated with all the business rules it still sometimes takes me an hour or two to trace through the code to explain to the BU why it treated certain data in a specific way.
And when they ask me to make changes... YIKES. Talk about cascade effect.
November 12, 2015 at 8:41 am
Jack Corbett (11/12/2015)
Sean Lange (11/12/2015)
Brandie Tarvin (11/12/2015)
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
That sounds like the conversations I have with myself when cracking open code I haven't seen in a few months. π
"Why did I write this like this? What the #$@% was I thinking? Oh well, it works."
Y'all are driving me nuts with this. This is why you put in comments on WHY you did it the way you did it, so when you go back you at least know the original reason.
Oh I do put comments in there. That doesn't stop me from questioning my code though. π
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
November 12, 2015 at 9:14 am
Sean Lange (11/12/2015)
Jack Corbett (11/12/2015)
Sean Lange (11/12/2015)
Brandie Tarvin (11/12/2015)
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
That sounds like the conversations I have with myself when cracking open code I haven't seen in a few months. π
"Why did I write this like this? What the #$@% was I thinking? Oh well, it works."
Y'all are driving me nuts with this. This is why you put in comments on WHY you did it the way you did it, so when you go back you at least know the original reason.
Oh I do put comments in there. That doesn't stop me from questioning my code though. π
I question my own code all the time. I just grabbed something to present tonight. I looked it over and wondered why I had some something the way I did. It's in production and works, but I still think I could do it more efficiently. It isn't a huge difference, but the question remains.
November 12, 2015 at 9:20 am
Ed Wagner (11/12/2015)
Sean Lange (11/12/2015)
Jack Corbett (11/12/2015)
Sean Lange (11/12/2015)
Brandie Tarvin (11/12/2015)
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
That sounds like the conversations I have with myself when cracking open code I haven't seen in a few months. π
"Why did I write this like this? What the #$@% was I thinking? Oh well, it works."
Y'all are driving me nuts with this. This is why you put in comments on WHY you did it the way you did it, so when you go back you at least know the original reason.
Oh I do put comments in there. That doesn't stop me from questioning my code though. π
I question my own code all the time. I just grabbed something to present tonight. I looked it over and wondered why I had some something the way I did. It's in production and works, but I still think I could do it more efficiently. It isn't a huge difference, but the question remains.
It can be difficult to know where to draw the line. You know your results are accurate, but you think the process can run faster than it does now. 10% faster - forget it. Twice as fast? Might be worth doing depending on how expensive the whole process is. 10x faster? Go for it.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
November 12, 2015 at 10:16 am
Brandie Tarvin (11/12/2015)
Steve Jones - SSC Editor (11/11/2015)
I saw the Comcast one. It's getting crazy.I'm about to start giving legitimate companies incorrect information, just so I know if my stuff is released, and perhaps it has limited value.
Oh I started lying about things like birth date and other stuff a long time ago. Facebook thinks I'm nearly 100 years old.
I do for most places, but not places like banks. I may start doing that, legal issues aside.
November 12, 2015 at 10:19 am
BTW, if you haven't seen it, I have a fundraiser going for one of the SQL Server community
https://voiceofthedba.wordpress.com/2015/11/12/make-a-sqlwish-come-true/
November 12, 2015 at 10:23 am
ChrisM@Work (11/12/2015)
Ed Wagner (11/12/2015)
Sean Lange (11/12/2015)
Jack Corbett (11/12/2015)
Sean Lange (11/12/2015)
Brandie Tarvin (11/12/2015)
Sean Lange (11/12/2015)
djj (11/12/2015)
Grant Fritchey (11/12/2015)
Still, could be fun. Build out a nested CTE inside a function, use the same table aliases over and over, don't format the code. It'll be impossible to read.Sounds like any program I have written and come back to after six months. π
Oh good...it isn't just my code then. π
My boss has looked at some of the convoluted stuff I've written and come back to ask "Why did you code it like that?"
My response is "Because it works."
He really doesn't have a response to that 90% of the time. @=)
That sounds like the conversations I have with myself when cracking open code I haven't seen in a few months. π
"Why did I write this like this? What the #$@% was I thinking? Oh well, it works."
Y'all are driving me nuts with this. This is why you put in comments on WHY you did it the way you did it, so when you go back you at least know the original reason.
Oh I do put comments in there. That doesn't stop me from questioning my code though. π
I question my own code all the time. I just grabbed something to present tonight. I looked it over and wondered why I had some something the way I did. It's in production and works, but I still think I could do it more efficiently. It isn't a huge difference, but the question remains.
It can be difficult to know where to draw the line. You know your results are accurate, but you think the process can run faster than it does now. 10% faster - forget it. Twice as fast? Might be worth doing depending on how expensive the whole process is. 10x faster? Go for it.
Even then, if it's code that runs once a quarter, you may be better off directing your energies elsewhere. Try asking your DBA which are the top 20 most expensive queries in production, based on recent usage, and focus on those. Even a 10% boost here should have a better overall effect than 1000% on a little-used query.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
November 12, 2015 at 11:02 am
Steve Jones - SSC Editor (11/12/2015)
BTW, if you haven't seen it, I have a fundraiser going for one of the SQL Server communityhttps://voiceofthedba.wordpress.com/2015/11/12/make-a-sqlwish-come-true/
+200
π
November 12, 2015 at 11:34 am
MUST Resist...temptation...bad...joke!!
π
Viewing 15 posts - 51,346 through 51,360 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply