September 11, 2013 at 5:39 am
The correct answer is 0 since 'steppenwolf' is 11 characters long and would return an error.
ToddR
September 11, 2013 at 5:44 am
isaquedejair (9/11/2013)
Discordo do resultado ser "2", pelo fato de que no momento de gerar o insert ocorre um erro"String or binary data would be truncated.", o ultimo nome 'Steppenwolf' excede 10 caracteres
É galego ou é portugués?
Tom
September 11, 2013 at 5:47 am
Todd Reddinger (9/11/2013)
The correct answer is 0 since 'steppenwolf' is 11 characters long and would return an error.
It's amazing that in 7 pages of discussion, you're the first person to point that out 😉
September 11, 2013 at 5:55 am
LOL...here's my thought process.
Quick read - looks like it should return 2 rows.
Hmmm...are 2 rows = 2 results? Not really...it's 1 result.
Look again...looks like Steppenwolf will cause an error.
Hmmm...does that mean that it is 1 result (the error) or 0 rows?
Grrrrr....the subject of the question is "wildcards" so I will assume that the error was an accident and go with my first thought of 2.
Run the code and go back through the same logic again - same outcome - my answer is 2.
That's a lot of exercise for a seemingly simple question 🙂
September 11, 2013 at 5:56 am
batgirl (9/11/2013)
LOL...here's my thought process.Quick read - looks like it should return 2 rows.
Hmmm...are 2 rows = 2 results? Not really...it's 1 result.
Look again...looks like Steppenwolf will cause an error.
Hmmm...does that mean that it is 1 result (the error) or 0 rows?
Grrrrr....the subject of the question is "wildcards" so I will assume that the error was an accident and go with my first thought of 2.
Run the code and go back through the same logic again - same outcome - my answer is 2.
That's a lot of exercise for a seemingly simple question 🙂
Did you get into a flap? 😛
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 11, 2013 at 5:59 am
Me too (SQL2008R2).
September 11, 2013 at 6:12 am
The correct answer should be zero because mychar is only declared as a varchar 10 and Steppenwolf is 11 characters so the result set will return:
Msg 8152, Level 16, State 14, Line 3
String or binary data would be truncated.
The statement has been terminated.
(0 row(s) affected)
September 11, 2013 at 6:25 am
Disappointing to get the answer "wrong" when I answered correctly. Were we supposed to assume bugs were fixed, and give our answer based on the correct varchar precision?
September 11, 2013 at 6:27 am
I am familiar with the wildcard operator and like everyone else, the answer should have been 2, but because of the insert issue, I also chose 0 knowing that the insert statement would fail. The results returned from the batch is zero
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
September 11, 2013 at 6:39 am
The last string 'Steppenwolf' is 11 characters long, so the insert would have failed, and hence no rows will be returned by the Select statement. so the answer should be 0
September 11, 2013 at 6:40 am
Msg 8152, Level 16, State 14, Line 3
String or binary data would be truncated.
The statement has been terminated.
(0 row(s) affected)
Question Faulty --> I want my point back!!! :w00t:
September 11, 2013 at 6:42 am
Msg 8152, Level 16, State 14, Line 3
String or binary data would be truncated.
The statement has been terminated.
(0 row(s) affected)
Question is Faulty => I want my point back :w00t:
September 11, 2013 at 6:44 am
Dear Steve
Can you change the points system so that if someone replies pointing out an error and 8 pages of people have already replied pointing out the same error in the same way, then instead of giving them an extra point, they instead have 10 points subtracted?
Thanks in advance
September 11, 2013 at 6:59 am
Carlo Romagnano (9/11/2013)
The correct exceution of the query depends on ansi_warnings
set ansi_warnings off
DECLARE @i TABLE( mychar VARCHAR(10));
INSERT @i VALUES ('Steve'), ('Stephan'), ('Stephanie')
, ('Sterling'), ('Steppenwolf')
SELECT mychar
FROM @i
WHERE mychar LIKE 'Ste[^p]%'
It returns two rows in ONE resultset.
The question asks how many results ...?
The resultset is only ONE.
No, there is one resultset with two results in it.
September 11, 2013 at 7:03 am
Toreador (9/11/2013)
Dear SteveCan you change the points system so that if someone replies pointing out an error and 8 pages of people have already replied pointing out the same error in the same way, then instead of giving them an extra point, they instead have 10 points subtracted?
Thanks in advance
How else would they get their point back?
I've found that the discussions about the QotD are generally more informative than the questions themselves. Mostly because the questions either have an accidental mistake, a purposeful mistake or a poor explanation. Either way I almost always learn something new.
Viewing 15 posts - 61 through 75 (of 145 total)
You must be logged in to reply to this topic. Login to reply