The Percent Sign in T-SQL

  • Comments posted to this topic are about the item The Percent Sign in T-SQL

    The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking

  • Easy one 😀

    M&M

  • Thanks for easy question. 🙂

  • easy one, thanks

    Iulian

  • Nice and easy, good for a Monday morning. Thanks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Nice easy one to start of the week, cheers. 😀

    _____________________________________________________________________
    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • Thanks.

    It would have been nice to have a shortcut for 0/0 (divide zero by zero) :-).

  • I got this right but...

    SELECT 0%0

    gives

    Msg 8134, Level 16, State 1, Line 1

    Divide by zero error encountered.

    So it seems you can use it to divide 0 by 0 and get an error.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • mtassin (2/28/2011)


    I got this right but...

    SELECT 0%0

    gives

    Msg 8134, Level 16, State 1, Line 1

    Divide by zero error encountered.

    So it seems you can use it to divide 0 by 0 and get an error.

    🙂

    This makes sense, since a modulus can be defined as a product of division, you have to be able to do the division. Some systems, though, define x mod 0 as x (i.e, the difference between x and the nearest multiple of 0 [which is 0 (because 0 is the only multiple of 0.)])

  • So happy that over 80 percent of us know math.

    Can you imagine how hard it would be a SQL developer or DBA if you didn't learn higher level math?

  • mtassin (2/28/2011)


    I got this right but...

    SELECT 0%0

    gives

    Msg 8134, Level 16, State 1, Line 1

    Divide by zero error encountered.

    So it seems you can use it to divide 0 by 0 and get an error.

    Seriously? 😛

  • sknox (2/28/2011)


    mtassin (2/28/2011)


    I got this right but...

    SELECT 0%0

    gives

    Msg 8134, Level 16, State 1, Line 1

    Divide by zero error encountered.

    So it seems you can use it to divide 0 by 0 and get an error.

    🙂

    This makes sense, since a modulus can be defined as a product of division, you have to be able to do the division. Some systems, though, define x mod 0 as x (i.e, the difference between x and the nearest multiple of 0 [which is 0 (because 0 is the only multiple of 0.)])

    Yeah, I just included the "To divide by zero and get an error" as a joke. If you look at the symbol and take it at face value, that's what the symbol looks like.

    p.s. To be more clear, it looks like a small zero divided by zero: 0/0.

    The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking

  • I feel so silly for selecting the wrong answer - which was so obviously wrong..I am humbled. Thank goodness it's Monday so I can blame something 😀

  • mtillman-921105 (2/28/2011)

    Yeah, I just included the "To divide by zero and get an error" as a joke. If you look at the symbol and take it at face value, that's what the symbol looks like.

    p.s. To be more clear, it looks like a small zero divided by zero: 0/0.

    Gotta be careful with jokes... as I said, I got this one right.

    But somebody else could have said "Hey if I modulus 0 by 0 I get a divide by zero error!" and selected the last option, not realizing you were referring to what the % sign looks like. 🙂



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • mtassin (2/28/2011)


    But somebody else could have said "Hey if I modulus 0 by 0 I get a divide by zero error!" and selected the last option, not realizing you were referring to what the % sign looks like.

    Which would mean nothing unless they could find documentation supporting the obvious wrong answer. It was a multiple choice question with one right answer.

    Test taking 101 tells us to select the answer that is MOST correct.

    That was answer 3.

    I like it when there are joke answers that are funny IF you understand the questions, or what you are reading. It has been proven that these questions improve learning.

Viewing 15 posts - 1 through 15 (of 25 total)

You must be logged in to reply to this topic. Login to reply