July 10, 2009 at 4:26 pm
Michael Valentine Jones (7/10/2009)
Here is a great story about a "Spreadsheetized" design where all the companies data was stored in a single table.Death by Delete
http://thedailywtf.com/Articles/Death-by-Delete.aspx
"...
One day, a developer was optimizing the database and removing records that MegaPetCo no longer needed. All it took was a single, poorly formed delete query to wipe out each and every row in the database table.
To say the developer panicked is akin to describing a quadruple amputation as a mere flesh wound. MegaPetCo's sales immediately ground to a halt. Along with everything else. Payroll, logistics, reporting, purchasing, you name it. Its Web site didn't work -- but that was the least of the company's worries. The status of its backups was bleaker still: None. Zip. Zilch. Nada.
...
...
Unfortunately, the single delete query proved to be far more than MegaPetCo could bear. Within a few months, the company filed for bankruptcy and was forced to close every one of its stores -- laying off several hundred people along the way."
Ha! That's settles it, Spreadsheetized is not going to be part of my technical vernacular!
July 10, 2009 at 4:37 pm
DROP TABLE [EveryThing] :hehe:
ATBCharles Kincaid
July 10, 2009 at 4:48 pm
Charles Kincaid (7/10/2009)
If you got Jeff, Joe, Andy, Phil, and Steve in a a single room the angels would not commence singing and no sparkly glowing would start.
Heh... I think most angels would be smart enough to either avoid the room altoghether or to bring beer. 😛
The glow would most certainly appear in the form of a wonderful BBQ... pork chops, of course. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
July 11, 2009 at 4:03 am
Answering "never, ever use a cursor" or something equally smart.
The poster did not ask for a personal opinion about cursors (even if it's a wise one), he asked for help on how to use a cursor. So this kind of answer looks more like some fatwah proffered by an integrist ayatollah than anything else.
In such case, what prevents the adviser from:
1. Aswer the question if he or she knows the answer.
2. Explain why cursors should be avoided.
or:
1. Condescendingly sigh when he or she reads the question.
2. Leave the question alone and not answer it.
July 11, 2009 at 7:47 am
rf44 (7/11/2009)
Answering "never, ever use a cursor" or something equally smart.The poster did not ask for a personal opinion about cursors (even if it's a wise one), he asked for help on how to use a cursor. So this kind of answer looks more like some fatwah proffered by an integrist ayatollah than anything else.
In such case, what prevents the adviser from:
1. Aswer the question if he or she knows the answer.
2. Explain why cursors should be avoided.
or:
1. Condescendingly sigh when he or she reads the question.
2. Leave the question alone and not answer it.
Partly disagree here. True, you should just answer never, ever use a cursor, but that should not stop someone from trying to a) find out why they think they need a cursor, and b) showing them a better way when a cursor really isn't needed.
Edit: added missing word to sentenace.
July 11, 2009 at 9:08 am
Lynn Pettis (7/11/2009)
Partly disagree here. True, you should just answer never, ever use a cursor, but ....
Is there a 'not' missing from that sentence?
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
July 11, 2009 at 2:14 pm
Just some quotes out of the field :
- don't implement DRI, because that will only slow you down !
(Your application will have control anyway)
- Remove DRI, this way you can load ALL your data, and it is faster.
- implement date/datetime/time in varchar columns, so you can control how it is being presented
- always shrink your db after a rebuild of indexes
- if your sqlserver blocks your queries, just reboot it and it will be fixed.
(or switch to Oracle)
- don't consult your dba. We know our business.
:-D:-P:w00t::hehe::laugh:
and it actually felt good to type it overhere :Whistling:
:satisfied:
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
July 11, 2009 at 2:23 pm
Only heard it once , but it was from a trainer on a vb .net course from one of the largest training companies in the uk.
Dont use stored procedures. A friend of mine did , his database got corrupted and he lost the lot.
Where do you start on pointing out what is wrong with that ?
July 11, 2009 at 9:06 pm
GilaMonster (7/11/2009)
Lynn Pettis (7/11/2009)
Partly disagree here. True, you should just answer never, ever use a cursor, but ....Is there a 'not' missing from that sentence?
Yes there is. I'll go back and fix that. Thanks. 😉
July 12, 2009 at 7:49 am
Dave Ballantyne (7/11/2009)
Only heard it once , but it was from a trainer on a vb .net course from one of the largest training companies in the uk.Dont use stored procedures. A friend of mine did , his database got corrupted and he lost the lot.
Where do you start on pointing out what is wrong with that ?
I've actually heard people say that very same thing a couple of times over the years. That's gotta be a tie for people that say it's ok to use cursors just because you can't think of a better way. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
July 12, 2009 at 7:57 am
rf44 (7/11/2009)
Answering "never, ever use a cursor" or something equally smart.The poster did not ask for a personal opinion about cursors (even if it's a wise one), he asked for help on how to use a cursor. So this kind of answer looks more like some fatwah proffered by an integrist ayatollah than anything else.
Heh... Kids that play with guns don't ask for personal opinions either. 😉 Although I agree that saying "never use a cursor" is wrong overall, it's right 99.99% of the time. If someone is using a cursor or is actually asking for help using a cursor, I'm going to show them a different way whether they asked for that or not and it may require me asking some questions about "the cursor". You can watch... 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
July 12, 2009 at 1:26 pm
Maybe I should precise that I never intended to promote or even condone the use of cursors. I know that cursors are not efficient tools in MS SQL Server (to say the least! It's another story in Oracle, though).
What I meant was that the answer "Never... etc." was inadequate because:
1) It does not answer the question (when I ask "What time is it?' I do not expect an answer such as "Take an umbrella, it's going to rain").
2) It is not educative or even helpful because it does not provide an explanation (would it be a short one) of why a cursor should not be used, and if it does not provide a better alternative for performing the same action (if it's possible).
Regards.
July 12, 2009 at 1:55 pm
rf44 (7/12/2009)
Maybe I should precise that I never intended to promote or even condone the use of cursors. I know that cursors are not efficient tools in MS SQL Server (to say the least! It's another story in Oracle, though).What I meant was that the answer "Never... etc." was inadequate because:
1) It does not answer the question (when I ask "What time is it?' I do not expect an answer such as "Take an umbrella, it's going to rain").
2) It is not educative or even helpful because it does not provide an explanation (would it be a short one) of why a cursor should not be used, and if it does not provide a better alternative for performing the same action (if it's possible).
Regards.
Based on my somewhat fatigued memory, I don't remember any of the main players on this site ever saying "Never, ever use a cursor" without explaination or trying to find out why the individual felt it was necessary to use a cursor. Not saying it hasn't happened, just saying that most of us try to steer people away from them by offering better solutions if we can get the needed information to do so.
July 12, 2009 at 3:22 pm
Lynn,
I never said it was an answer you see all the time. I just replied to the question "What's the worst SQL Server advice you see regularly", and believe me it happens, here and on some other sites, more regularly than you seem to remember. Once more, I did not intend to attack anybody with my post.
Regards.
July 12, 2009 at 3:54 pm
rf44 (7/12/2009)
Lynn,I never said it was an answer you see all the time. I just replied to the question "What's the worst SQL Server advice you see regularly", and believe me it happens, here and on some other sites, more regularly than you seem to remember. Once more, I did not intend to attack anybody with my post.
Regards.
And I didn't say it didn't happen on this site. I just said my fatigued memory doesn't recall it AND that the more knowledgeable people on this site don't leave it at "Don't do it." They continue to ask why the individual wants to use or feels they need to use a cursor and proceeds to try and show why you don't want to use cursors. I've been there in the thick of things trying to convice someone that cursors are not the way to do things most of the time. Some people are just stuck in the RBAR way of doing things and have to be dragged into thinking in a more set-based manner.
Viewing 15 posts - 31 through 45 (of 52 total)
You must be logged in to reply to this topic. Login to reply