T-SQL Powers

  • Comments posted to this topic are about the item T-SQL Powers

  • Thanks

    Good question - have not had to use in so long - it is good to be remineded of those long forgotten operators ..

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Nice attempt to a trick question 😀

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

  • This was removed by the editor as SPAM

  • Nice, back to basics.

    I don't use this in real-time scenario at all, but few weeks ago I was just looking at them just to refresh my memory. Infact I used calculator in the programmer view and did the xor there and selected the answer 😎

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Great question. Nice to reinforce basic concepts that are not too often used.

  • Why is this called "T-SQL Powers" if the topic is bitwise xor ?

    I was a little confused since the notation 2^3 = 8 is fairly common. When I didn't find an exponentiation assignment operator I figured the "error" result was the correct answer.

    Oh.. T-SQL Powers as in "powers of observation" rather than exponentiation. +0 for being a math nerd.

  • Dammit, a trick question. Annoying when the theme of QoTW is to avoid these in usual cases!

    Learned something new though, so thanks!

    If something looks too good (simple) to be true, it normally is ... *grumbles*

    ---

    Note to developers:
    CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
    So why complicate your code AND MAKE MY JOB HARDER??!:crazy:

    Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
    My blog: http://uksqldba.blogspot.com
    Visit http://www.DerekColley.co.uk to find out more about me.

  • QotD = fun today. Took me a bit to figure it out.

  • I agree this was a fun one. This operator was new to me...had to break out the notepad after searching through BOL. A nice refresher from the college days...Good Times!

    Aigle de Guerre!

  • This is an easy question for those not fooled by the title who either remember that in SQL the power operator (POWER) is written as a function (not as an operator) or remember that the ^ operator is bitwise XOR (or both).

    A bit of a nasty trick question, though, given that title, since ^ is well established in some contexts as bitwise AND and in others as the POWER operator and the answer options included both the bitwise AND and the POWER results for the arguments as well as the bitwise XOR result.

    Tom

  • Good one 🙂

    [font="Verdana"] There is no Wrong time to do a Right thing 🙂 [/font]

  • Great question. Haven't used either the power() function OR the ^ operator in a long time, so a good reminder that there's a lot more to SQL than I get to use every day.

    Rob Schripsema
    Propack, Inc.

Viewing 13 posts - 1 through 12 (of 12 total)

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