@nerdydeeds said:
Dynamic SQL gone horribly awry?
I did some digging and that's what it is. I already yelled at the developer who wrote it.
@nerdydeeds said:
Dynamic SQL gone horribly awry?
... what's going on in my coworker's stored procedure:
CREATE TABLE failed because column 'c1017' in table '#output' exceeds the maximum of 1024 columns.
I think the White Sox and the Indians are stuck in a temporal causality loop:
@webzter said:
@Edgesmash said:
I don't mean to flame here, but I think you're all wrong (other than the OP). The "right" answer to this question has nothing to do with the person you name. Rather, the right/wrong part is the justification of the person. As has been said, an interviewee could answer Hitler and justify it well enough to merit a job. Also,
someone could answer "George Washington" and then totally punt on the justification... "Well, he like, founded our nation and stuff..."Well, to be honest, I don't think that's what the OP meant at all. Because, if that was the case, then there would be one wrong answer. The candidate didn't elaborate on the answer and didn't provide a thoughtful justification for their stance. Rather, the OP said "there are many WRONG answers. "
I don't mean to flame here, but I think you're all wrong (other than the OP). The "right" answer to this question has nothing to do with the person you name. Rather, the right/wrong part is the justification of the person. As has been said, an interviewee could answer Hitler and justify it well enough to merit a job. Also,
someone could answer "George Washington" and then totally punt on the justification... "Well, he like, founded our nation and stuff..."
This is one of those questions that attempt to determine the intelligence of the person. If the interviewee is intelligent, they can answer this question "correctly" every time. You all have met the programmer who writes code well and can answer all the tech questions well, but turns out to have no real intelligence outside the tech arena. Granted, for some jobs, you don't need that, but
if you're trying to hire top notch programmers, you want people who are intelligent.
In my last interview, I asked about his college experience, then just kept asking questions in the thread of the conversation. The point of these questions was to determine if he was intelligent. He was, and we hired him.
@sycro said:
@cavemanf16 said:@FraGag said:@sirhegel said:Note the ingenious fact, that the (global!) Tim variable has to be updated and this method has to be called repeatedly by some other routine to actually see some animation.
Actually, Now is a static (shared in VB (how many times have I seen that in the MSDN Library?)) property, thus the Tim variable is totally useless: replace Me.Tim.Now.Second with Date.Now.Second or DateTime.Now.Second.
Also, I've noticed that the values in the Case statements are not even following a rule: 0, 3, 6, 9, 12, 16, 19, 21, ... and the final 59. If this was wanted, then the modulus solution doesn't work, but I believe these are mistakes.
My guess is that this 'Tim' character actually did some rudimentary testing with his new algorithm and found that the milliseconds of delays in all this case checking in VB added up over the first 12 or so seconds, and actually resulted in a 1 second delay. Therefore, to make it not look f'd up to the end user (because the Me.Tim.Now.Second call wasn't returning 15 and correctly printing "..", but rather it was returning 16 and defaulting to the "else" case statement to print "...") he just padded his case statement with that 1 second delay, adding "16" as the next instance of printing ".." instead of using "15". Same thing occurs again at the value of "59" as you noticed, and then he adjusted the whole thing to at least get it to display correctly.
Granted, the whole thing is needlessly complex, but at least give the guy props for unit testing! ;)
You can't give somebody props for something you assume they may have done. Also, your guess makes no sense given his use of 21. Would it be confusing to go from "." to "...", but not to go from ".." back to "." ?
@unklegwar said:
@Pap said:
We call these "mistakes."Well apparently, the submitter never ever makes any of those. I'm sure he's never added/modified code that broke something. Someday, I hope to reach that kind of coding excellence. For now I am relegated to admitting that I make mistakes just like all of my colleagues do. Oh, the humanity!
The edit looks ok, unless you know that every office is its own parent and child, so this procedure always returns no rows.Um, isn't that the WTF? Altho it could be the beginning of a new class of family tree jokes:
Ha-ha, your family tree is a straight line!
Oh yeah? Well your family tree is a mobius strip!
True, it could've been a whole lot worse. He did just add a check (that always returns false), and he did claim responsibility.
Still, it was annoying when a client testing the software called me, asking why he didn't have access to any offices.
Revisiting a screen for the first time that day, I find that one of my dropdown menus is not populating. Funny, it worked yesterday. Delving into the code, I find my stored procedure is returning zero rows. Delving into the query analyzer, I find my stored procedure has been alerted:
SELECT distinct oo.child_office_code,
bo.office_name, bo.office_abbreviation,
su.user_code, su.first_name, su.last_name,
su.role_code, sr.role_name
FROM sec_users su
INNER JOIN sec_users_office suo ON
su.user_code = suo.user_code
INNER JOIN office_owner oo ON
suo.office_code = oo.office_code
INNER JOIN sec_roles sr ON
su.role_code = sr.role_code
INNER JOIN base_office bo ON
oo.child_office_code = bo.office_code
WHERE su.user_code = @user_code
-- modified [dave s, 17-Jan-2007]:
and suo.office_code not in (select child_office_code from office_owner)
-- end modification
The edit looks ok, unless you know that every office is its own parent and child, so this procedure always returns no rows. Fortunately, I had already written a better version of this procedure using a view, so no code was lost.