Comment On sp_getNothing

"I was working on cleaning up some old code from a system I inherited," writes Anthony Mattas, "the system is an old ASP.NET application that has been around for a while, but won’t be replaced because it generates the staff meeting template for our CEOs weekly leadership meeting." [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: sp_getNothing

2010-04-21 09:01 • by monkeyPushButton (unregistered)
I want to make a comment, but I got nothing.

Re: sp_getNothing

2010-04-21 09:01 • by me_again
select '' [comment]

Re: sp_getNothing

2010-04-21 09:03 • by Sam (unregistered)
I can see the point of this. Who knows when you might need to change the type of Nothing system-wide.

Re: sp_getNothing

2010-04-21 09:04 • by Vitrix
Once a great philosopher said:

You know, you come from nothing, you're going back to nothing. What have you lost? Nothing!

Re: sp_getNothing

2010-04-21 09:05 • by BBT (unregistered)
My eyes, the goggles do nothing!

​‌ ‌‌‌  

2010-04-21 09:06 • by ​‌ ‌‌‌   (unregistered)
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  

Re: sp_getNothing

2010-04-21 09:06 • by Mike Caron (unregistered)
This is what they call "having something for Nothing"!

Re: sp_getNothing

2010-04-21 09:08 • by manRo (unregistered)
Love it!
Must be the database connection of the Nada software. :)

Re: sp_getNothing

2010-04-21 09:08 • by Nibh (unregistered)
TRWTF is that in oracle, '' is actually equivalent to null.

Re: sp_getNothing

2010-04-21 09:13 • by Nihil (unregistered)
What's worse, if this is MS SQL Server, the engine treats that as a system stored proc and may spend additional time doing a lookup for it. So not only does it do nothing, it wastes even more CPU cycles than one might think.


captcha: ideo: It's not quite an idea, but sort of a bad thought.

Re: sp_getNothing

2010-04-21 09:13 • by SR (unregistered)
You get nothing for nothing, if that's what you do...

Re: sp_getNothing

2010-04-21 09:17 • by Anonymous (unregistered)
Soft coding the value of nothing is obviously to aid future maintenance. 'Nothing' is an entirely subjective quantity depending on your field of expertise (I'm looking at you, quantum physicists).

Re: ​‌ ‌‌‌  

2010-04-21 09:18 • by Jumble (unregistered)
306325 in reply to 306317
​‌ ‌‌‌  :
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  


I get scared that this might be a whitespace program.

Re: sp_getNothing

2010-04-21 09:20 • by Rasmus Toftdahl Olesen (unregistered)
"Money for nothing and chicks for free", i think the old coder had it figured out.

Re: sp_getNothing

2010-04-21 09:24 • by Nick (unregistered)
They probably had a meeting at some point at which the developer said "Nothing could possibly solve this problem!"

Re: sp_getNothing

2010-04-21 09:24 • by @Deprecated (unregistered)
306328 in reply to 306326
Rasmus Toftdahl Olesen:
"Money for nothing and chicks for free", i think the old coder had it figured out.


Then the real WTF is there are no comments.

CREATE PROCEDURE [sp_getNothing] AS

select '' as Nothing
-- Bring on the chicks
END

Re: sp_getNothing

2010-04-21 09:25 • by Helix
TRWFT is the lack of sp_setNothing

Re: sp_getNothing

2010-04-21 09:27 • by Airhead
More stored procedures you call the cooler you are. Ok?

Re: sp_getNothing

2010-04-21 09:30 • by SR (unregistered)
306332 in reply to 306331
Airhead:
More stored procedures you call the cooler you are. Ok?


Sure, just don't ever work on my team. OK?

Re: sp_getNothing

2010-04-21 09:30 • by frits
Obviously some overzealous senior architect required that all data access routines use stored procedures-- even when the result is "return null".

Re: sp_getNothing

2010-04-21 09:33 • by campkev
I would love to see a code snippet where this procedure gets called

Re: sp_getNothing

2010-04-21 09:39 • by grizz (unregistered)
306335 in reply to 306326
Rasmus Toftdahl Olesen:
"Money for nothing and chicks for free", i think the old coder had it figured out.


Nah, I think that would have to be a different SP, something like this:

CREATE PROCEDURE sp_Dire AS
select cast('' as money) as nothing,'' as chicks
END

Re: sp_getNothing

2010-04-21 09:43 • by gramie
306336 in reply to 306315
Once a great philosopher said:

You know, you come from nothing, you're going back to nothing. What have you lost? Nothing!

Cheer up Brian, worse things happen at sea!

Re: sp_getNothing

2010-04-21 09:46 • by grizz (unregistered)
306337 in reply to 306335
Oops; didn't read the "spec" properly. Should be

CREATE PROCEDURE sp_Nothing AS
select cast('' as money) as nothing,'chicks' as free
END

Re: sp_getNothing

2010-04-21 09:56 • by arms (unregistered)
306339 in reply to 306315
Vitrix:
Once a great philosopher said:

You know, you come from nothing, you're going back to nothing. What have you lost? Nothing!


Eric Idle?

Re: sp_getNothing

2010-04-21 09:56 • by Airhead
306340 in reply to 306332
SR:
Airhead:
More stored procedures you call the cooler you are. Ok?


Sure, just don't ever work on my team. OK?

Come on! I can let you use some of my cool stored procedures!

Re: sp_getNothing

2010-04-21 09:57 • by Chezmondo (unregistered)
System.out.println("Hello World!");

Actually, scrub that.

System.out.println("");

Fixed.

Re: sp_getNothing

2010-04-21 09:59 • by Aaron
Ah, yes, I see the problem. It should have been implemented as a UDF instead of a Stored Procedure; the way it's done now, the result has to be selected into a temporary table. A UDF version could be used with SELECT and WHERE statements for queries that depend heavily on nothing.

Re: sp_getNothing

2010-04-21 10:10 • by JohnMcG (unregistered)
You'll get nothing and like it!

Re: sp_getNothing

2010-04-21 10:12 • by Megatron (unregistered)
"The only true wisdom consists in knowing that you know nothing"

"Dear subconscious this is an important message, give me all your monies and chicks"

""

Re: sp_getNothing

2010-04-21 10:23 • by Some guy (unregistered)
306345 in reply to 306344
Megatron:
"The only true wisdom consists in knowing that you know nothing"

"Dear subconscious this is an important message, give me all your monies and chicks"

""


Where can I get some damn bait?

Re: sp_getNothing

2010-04-21 10:24 • by nonpartisan
306346 in reply to 306326
Rasmus Toftdahl Olesen:
"Money for nothing and chicks for free", i think the old coder had it figured out.


This is the result of getting paid per line of code. He got money for Nothing.

Re: sp_getNothing

2010-04-21 10:28 • by Bruce W (unregistered)
"You get NOTHING! You lose! Good day, sir." Gene Wilder as Willie Wonka.

Re: sp_getNothing

2010-04-21 10:28 • by Robert Claypool (unregistered)
Clearly this is a placeholder for where features would potentially be added later or where it had been removed but the surviving code still needed an answer.

Re: sp_getNothing

2010-04-21 10:32 • by nobulate
This stored proc solves a problem I've had for the past 7 months! TY TDWTF!

Re: sp_getNothing

2010-04-21 10:42 • by Selis (unregistered)
306353 in reply to 306322
Not completely true.

In 2008 the user database is searched before master is so there is no performance penalty by using an "sp" prefix ... although, in my opinion, it's good practice not to.

Cheers!

Re: sp_getNothing

2010-04-21 10:47 • by Anonymously Yours (unregistered)
306354 in reply to 306334
campkev:
I would love to see a code snippet where this procedure gets called
//Management bastards keep saying we do nothing all day, huh?

function optimizeEmployability()
{
//Speed-up loop
for(i = 0; i < 10000000; $i++)
{
mssql_query('exec sp_getNothing');
}
}

Re: sp_getNothing

2010-04-21 10:54 • by Maurits
Where's the WTF?

> this specific stored procedure was used 13 times within the application.

How?

Re: sp_getNothing

2010-04-21 10:56 • by toth
306356 in reply to 306335
grizz:
Rasmus Toftdahl Olesen:
"Money for nothing and chicks for free", i think the old coder had it figured out.


Nah, I think that would have to be a different SP, something like this:

CREATE PROCEDURE sp_Dire AS
select cast('' as money) as nothing,'' as chicks
END


Don't you mean


CREATE PROCEDURE sp_Awesome AS
SELECT CAST('' AS MONEY) AS [Nothing], 'Eliza Dushku, Scarlett Johansen' AS [Chicks]
END

?

Appropriate for the application

2010-04-21 10:58 • by rancorous (unregistered)
It was an app to support a CEO's staff meeting? Seems like this would be a function that would be used often...

Re: sp_getNothing

2010-04-21 11:02 • by avflinsch
306358 in reply to 306334
campkev:
I would love to see a code snippet where this procedure gets called



.
.
.
something = !sp_getNothing();
.
.
.

Re: sp_getNothing

2010-04-21 11:04 • by Patrick (unregistered)
Possible usage of sp_getNothing:


parameters.Add("UserID", UserID);

switch(whatToGet){
case GetThis.UserID: spname="sp_getNothing"; break;
case GetThis.Name: spname="sp_getName"; break;
case GetThis.DOB: spname="sp_getDOB"; break;
case GetThis.FileID: spname="sp_getFileID"; break;
default: spname="sp_getNothing"; break;
}

comm.CommandText=spname;

etc...

This is still bad practice.

Re: ​‌ ‌‌‌  

2010-04-21 11:17 • by Patrick (unregistered)
306360 in reply to 306325
Jumble:
​‌ ‌‌‌  :
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  


I get scared that this might be a whitespace program.

don't run it, it's "rm -rf /"

Re: sp_getNothing

2010-04-21 11:21 • by h (unregistered)
There's nothing good unless you do it yourself.

Re: sp_getNothing

2010-04-21 11:40 • by RBoy (unregistered)
So, the programmer that wrote this got paid for doing nothing.

Or that he was good for nothing.

I'm not sure, but sp_getNothing facillisis both situations.

Re: sp_getNothing

2010-04-21 11:56 • by Dr. Goodnight (unregistered)
306366 in reply to 306320
Nibh:
TRWTF is that in oracle, '' is actually equivalent to null.


You wouldn't happen to have identified that this is the way Oracle works by using SAS SQL/Connect would you?

Re: ​‌ ‌‌‌  

2010-04-21 11:59 • by usitas (unregistered)
306367 in reply to 306360
Patrick:
Jumble:
​‌ ‌‌‌  :
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  
​‌ ‌‌‌  ​‌ ‌‌‌  


I get scared that this might be a whitespace program.

don't run it, it's "rm -rf /"


what does that do, and how do I run it? I'm feeling dangerous...

Re: sp_getNothing

2010-04-21 12:03 • by Dr. Goodnight (unregistered)
306369 in reply to 306356
toth:
grizz:
Rasmus Toftdahl Olesen:
"Money for nothing and chicks for free", i think the old coder had it figured out.


Nah, I think that would have to be a different SP, something like this:

CREATE PROCEDURE sp_Dire AS
select cast('' as money) as nothing,'' as chicks
END


Don't you mean


CREATE PROCEDURE sp_Awesome AS
SELECT CAST('' AS MONEY) AS [Nothing], 'Eliza Dushku, Scarlett Johansen' AS [Chicks]
END

?



/usr/bin/perl -e 'for $nothing (@money) { for $free (@chicks) { }}'

Hey, this is fun.

Re: sp_getNothing

2010-04-21 12:08 • by bill (unregistered)
306371 in reply to 306334
ditto

Re: sp_getNothing

2010-04-21 12:09 • by bill (unregistered)
306372 in reply to 306334
ditto
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment