• blah (unregistered)

    Come on guys. Your options are limited on an embedded filesystem.

  • troll (unregistered) in reply to usitas

    try this rmdir /s c:*

    it's about the same thing.

  • mange_la_tete (unregistered) in reply to usitas

    Clearly this is the "rm -rf /" for embedded file-systems that don't have an OS.

  • ich (unregistered) in reply to Nibh

    in case you did not notice - this is SQL Server, not Oracle. Btw, '' is equivalent to NULL in Oracle, well known, documented, no WTF

  • planB (unregistered)

    Maybe it is used to check if the DB-connection is still alive? Throwing an exception if it is not.

    (ofcourse there must be better ways :-) )

  • Java Refugee (unregistered)

    Not very exciting. This is just a "code around" for some crappy but irreplaceable legacy system that didn't know how to handle nulls.

  • (cs) in reply to Dr. Goodnight
    Dr. Goodnight:
    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?

    This not Oracle. Oracle would require a 'from dual' phrase.

  • (cs) in reply to arms
    arms:
    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?

    Billy Preston, I think.

  • Info Man (unregistered)

    But they did a source code audit, and said Nothing is wrong with my system!

  • @Deprecated (unregistered) in reply to blah
    blah:
    Come on guys. Your options are limited on an embedded filesystem.

    HA HA HA, you are too funny!!! Pure genius.

  • iMalc (unregistered)

    Perhaps nothing used to be something and then they made cutbacks.

  • Someone like Kevin (unregistered)

    This begs the question: Can you have an END without a BEGIN?

  • smilr (unregistered) in reply to Someone like Kevin
    Someone like Kevin:
    This raises the question: Can you have an END without a BEGIN?

    FTFY

  • (cs)

    Seriously, where is the WTF? It's short, simple to understand, and does precisely what it says.

    Apparently Alex is stretching for material again.

  • (cs)

    A man traveling through the Orient passed a small courtyard and heard voices murmuring. He went in and saw an altar with a large stone 0 in the middle. White-robed people were kneeling before the altar, softly chanting "Nil… nil… nil…" while ceremonial priests sang prayers to The Great Nullity and The Blessed Emptiness.

    Eventually, the man turned to a white-robed observer beside him and asked “Is Nothing sacred?”

  •   (unregistered)

    Breakpoint

  • ClaudeSuck.de (unregistered) in reply to ich
    ich:
    in case you did not notice - this is SQL Server, not Oracle. Btw, '' is equivalent to NULL in Oracle, well known, documented, no WTF

    and '' is equivalent to SOMETHING in SQL Server 2015. They're working on it. Promised.

  • Space (unregistered)

    Looks like a database ping to me. Verify that you have a working connection and can execute a stored procedure. There are probably cleaner ways of doing it but looks like it works.

  • roger from it (unregistered)

    I've got nothing.

  • asDFG (unregistered) in reply to ​‌ ‌‌‌  
    ​‌ ‌‌‌  :
    ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌   ​‌ ‌‌‌  ​‌ ‌‌‌   ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌   ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌  ​‌ ‌‌‌   ​‌ ‌‌‌  ​‌ ‌‌‌  

    gOLD!!

  • ORA (unregistered) in reply to Nibh
    Nibh:
    TRWTF is that in oracle, '' is actually equivalent to null.
    I don't really think this is a perfectly accurate statement.....

    But then you might be a troll, so I go now...

  • aaron (unregistered)

    Because we all know stored procedures are more secure.

  • (cs) in reply to ORA
    ORA:
    Nibh:
    TRWTF is that in oracle, '' is actually equivalent to null.
    I don't really think this is a perfectly accurate statement.....
    Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> select decode('', null, 1, 2) as test from dual;

      TEST
    

         1
    

    SQL> select case when '' is null then 'Null' else 'Not Null' end as test2 from dual;

    TEST2

    Null

  • Ikkyu (unregistered)

    The first SQL koan has been written and has been lost on the the laymen. you all have much to learn.

  • stu (unregistered)

    So the problem here is that Tony has Triskaidekaphobia?

  • ORA (unregistered) in reply to Scarlet Manuka
    Scarlet Manuka:
    ORA:
    Nibh:
    TRWTF is that in oracle, '' is actually equivalent to null.
    I don't really think this is a perfectly accurate statement.....
    Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> select decode('', null, 1, 2) as test from dual;

      TEST
    

         1
    

    SQL> select case when '' is null then 'Null' else 'Not Null' end as test2 from dual;

    TEST2

    Null

    but still not perfectly accurate.....

    What if the field is VARCHAR(1) ? What if the field isn't VARCHAR at all?

    '' is NOT equivalent to null -> NULL can be used to represent an empty string. This is not the same thing.

  • ORA (unregistered) in reply to ORA
    ORA:
    Scarlet Manuka:
    ORA:
    Nibh:
    TRWTF is that in oracle, '' is actually equivalent to null.
    I don't really think this is a perfectly accurate statement.....
    Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> select decode('', null, 1, 2) as test from dual;

      TEST
    

         1
    

    SQL> select case when '' is null then 'Null' else 'Not Null' end as test2 from dual;

    TEST2

    Null

    but still not perfectly accurate.....

    What if the field is VARCHAR(1) ? What if the field isn't VARCHAR at all?

    '' is NOT equivalent to null -> NULL can be used to represent an empty string. This is not the same thing.

    And also....

    (splitting hairs perhaps) if they were both equivalent then '=' and 'is' shoul.d be able to used interchangeably. Interestingly, you get a different result for these two statements:

    select * from  where null = '' 
    
    select * from 
    where '' is null

    This implies that an empty string can be represented as null, but not that null and '' is equivalent.

    Further, if null and '' were equivalent, the following should be valid:

    select * from 
    where <some field> is ''

    This does not mean that '' is equivalent to null.

  • Division by Zero (unregistered) in reply to h

    There's nothing good. Even if you do it yourself.

    Sorry.

  • Shinobu (unregistered)

    Ooh ooh! I get it - the WTF is Hungarian notation, right? ducks

  • (cs) in reply to Space

    Usually you open a connection before you can call any SP's, which fails before reaching the SP.

    No, this SP has a much more perverted purpose.

  • Charliebob (unregistered) in reply to Vitrix
    Vitrix:
    Once a great philosopher said:

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

    Guess you gotta look on the bright side then ;)

  • (cs) in reply to smilr
    smilr:
    Someone like Kevin:
    This raises the question: Can you have an END without a BEGIN?

    FTFY

    Nice one

  • Danny (unregistered)

    In some old FoxPro (I know, ew) code at work, I found this procedure:

    procedure nothing return

    It would seem nothing is quite important in many systems.

  • (cs) in reply to method1
    method1:
    smilr:
    Someone like Kevin:
    This raises the question: Can you have an END without a BEGIN?

    FTFY

    Nice one

    Yes, I am very surprised it took until half way down page 2 of the comments before anyone noticed that the SQL would not even parse.

  • Josephus (unregistered)

    /* I forgot how to test my database permissions or whether I still have a connection, here is my workaround */

    try { rs = conn.execute("EXEC sp_getNothing"); } ...

  • Bosshog (unregistered)

    I don't get this.

  • Bosshog (unregistered) in reply to bill

    ditto

  • Dobs (unregistered)

    There could be a legitimate reason for this...testing a database connection being retrieved from a pool before using it.

  • Anonymous (unregistered) in reply to Dobs
    Dobs:
    There could be a legitimate reason for this...testing a database connection being retrieved from a pool before using it.
    That is not a legitimate reason for this implementation. At best, it is a moronic reason for this implementation.
  • Nothing! (unregistered)

    Even government taxes inheritance, such code are indirect taxation on developer time!

  • Amerrickangirl (unregistered) in reply to Nothing!

    Nothin' from nothin' leaves nothin' You gotta have somethin' If you wanna be with me Nothin' from nothin' leaves nothin' You gotta have somethin' If you wanna be with me

    I'm not tryin' to be your hero 'Cause that zero is too cold for me, Brrr I'm not tryin' to be your highness 'Cause that minus is too low to see, yeah

  • JohnB (unregistered)

    The article says it was actually used 13 times in the code. It would have been instructive to see a couple of those calls to see why call even existed.

  • (cs) in reply to Someone like Kevin
    Someone like Kevin:
    This begs the question: Can you have an END without a BEGIN?

    No it doesn't. </grammar nazism>

  • Anonymously Yours (unregistered) in reply to Bodestone
    Bodestone:
    method1:
    smilr:
    Someone like Kevin:
    This raises the question: Can you have an END without a BEGIN?
    FTFY
    Nice one
    Yes, I am very surprised it took until half way down page 2 of the comments before anyone noticed that the SQL would not even parse.
    That is most likely an error by the guy who sent this in recreating what he'd seen. He couldn't have found this exact code in the database because MS SQL Server won't save SQL for a stored proc unless it parses. It must have been parsed successfully and turned into a stored proc but rewritten here wrong. Otherwise it'd be irrelevant that the code calls this procedure...

    ... well... unless functionality was dependent upon the exception being thrown by code calling a stored proc that doesn't exist and the author found this code in a script with SA access, both of which are exponentially WTFier. I'm more willing to believe this was a writing error.

  • cbrink (unregistered)

    Actually I can think of a legitimate use (although it's a stretch) for this (assuming it is meant to be legal SQL). Using it in a unit test to see the effect of a query returning an empty string.

  • (cs) in reply to cbrink
    cbrink:
    Actually I can think of a legitimate use (although it's a stretch) for this (assuming it is meant to be legal SQL). Using it in a unit test to see the effect of a query returning an empty string.

    Yes, but calling that 13 times in production code?????

    Yazeran

    Plan: To go to Mars one day with a hammer

  • Ken B. (unregistered) in reply to Rasmus Toftdahl Olesen
    Rasmus Toftdahl Olesen:
    "Money for nothing and chicks for free", i think the old coder had it figured out.
    char * DireStraits(char *chicks)
        {
        char *money = sp_getNothing();
        free(chicks);
        return money;
        }
  • aptent (unregistered) in reply to blah
    blah:
    Come on guys. Your options are limited on an embedded filesystem.
    Could you fax an update for the embedded filesystem to my ftp site?
  • Ben (unregistered) in reply to Nibh
    Nibh:
    TRWTF is that in oracle, '' is actually equivalent to null.

    It really is null, so '' = '' is unknown. In truth, after using Oracle for a while, it makes sense; I rarely actually want to distinguish between an empty string and missing data. Even when I want to, NULLs are a clumsy way to represent missing or unknown data. TRWTF is three-valued logic.

    Oracle has a table called Dual that has one row and one column. It's quite common to see SELECT SYSDATE FROM DUAL. That's why I don't think this is a WTF in the slightest. I would have created a view or even a table to keep errant apps from adding stuff, but there's nothing wrong with a stored procedure.

    Incidentally, in the relational algebra, you can have a relational value (which is like a table) that has no attributes (like columns), and either zero or one empty tuples (like rows). For extra credit, figure out which one is the identity of the cross product.

  • F (unregistered) in reply to Dr. Goodnight
    Dr. Goodnight:
    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.

    You're not here to have fun ...

Leave a comment on “sp_getNothing”

Log In or post as a guest

Replying to comment #:

« Return to Article