April 20, 2009 at 9:29 pm
Comments posted to this topic are about the item left, right and %
April 21, 2009 at 5:21 am
Hrm, why did I do left 4!
Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2
April 21, 2009 at 6:15 am
excellent question using left and right and the modulus sign .only problem remember to take the remainder for the answer not the amount left after a divide to a whole integer
April 21, 2009 at 6:51 am
Nice question. One thing would have made it harder: having a fake string conversion error as an option. Honestly, I did not know that LEFT does an implicit conversion, but because there was no error as a choice, I figured it would convert correctly and then was able to work out the right - or should I say correct - answer.
So I'm happy that I got the correct answer, but I'm not happy that I didn't know about the implicit conversion. I suppose I should be happy, though, because that means that there is always more to learn with SQL Server! :w00t:
- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
April 21, 2009 at 6:54 am
webrunner (4/21/2009)
...One thing would have made it harder: having a fake string conversion error as an option...
I think that would have made the question worth the 2 points assigned to it. Not sure why a simple question like this is worth 2 points without it.
April 21, 2009 at 6:59 am
Chris Harshman (4/21/2009)
webrunner (4/21/2009)
...One thing would have made it harder: having a fake string conversion error as an option...I think that would have made the question worth the 2 points assigned to it. Not sure why a simple question like this is worth 2 points without it.
It was pay back for yesterday's question. Thanks Steve.
April 21, 2009 at 7:04 am
Implicit conversion to/from strings? I would have expected an error. But, since that wasn't a choice, I calc'd it and came up with the answer. It's always nice to learn something new.
April 21, 2009 at 7:54 am
I got the right and left part, I even figured it would convert as needed. What I couldn't do, was remember how Modulo worked. For some reason I thought to myself: 10 goes into 68 6 times, that must be correct. Then I got it wrong and immediately knew where I failed 🙁
April 21, 2009 at 8:45 am
I put this as two as I thought it was slightly more interesting, and required more thought, than lots of the T-SQL ones we have.
April 21, 2009 at 10:47 am
Steve Jones - Editor (4/21/2009)
I put this as two as I thought it was slightly more interesting, and required more thought, than lots of the T-SQL ones we have.
I'm not complaining, just saying I was suprised 😉
April 21, 2009 at 10:50 am
No worries. I understand, and it made me rethink it a bit. It's debatable if this is worth two points, and I'm happy to have the opinions. I just eyeball them, so having people question it helps me to be sure I'm paying attention.
Memorization, and triva tend to be one point. Simple SQL as well.
Go to 2 pts when it seems to require more thought. Beyond that I'm guessing.
April 23, 2009 at 3:59 pm
Arrrg... it's a % and not a / ..... must drink more caffeine and get more sleep...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
March 22, 2010 at 12:30 am
I am surprised... how come right opertor on 568 with value 2 will return 68.In the end we will have 8 modulo 10 which will return 0.
Please correct me if I am wrong.
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply